How to check empty condition in laravel blade with directive?

Laravel 7

Nicesnippets

337

19-04-2020


Hello Friend,

if you don't use if condition with empty then you can use empty directive. we don't use manually php empty function then use this directive. in laravel use this types of directive then it's run fast and improve your website performance.

In PHP

if(empty($myVariable)){

return true

}

In Laravel Blade

@empty($myVariable)

// $myVariable is "empty"...

@endisset

I hope it can help you...