Php – Laravel Blade how to use if statement for null or empty

bladelaravelphp

In the Blade templating engine, how to use "if" to determine null or empty?

{{{ Auth::user()->age }}}

Best Solution

You can do it as bellow

    @if (empty(Auth::user()->age))
      // your if code
    @else
     //  your else code
    @endif