How to check empty condition in laravel blade with directive?

10-Apr-2023

.

Admin

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...

#Laravel 7