Laravel @guest Directive

We use this directive to show something by detecting that the user is not logged in. Normally we show content by checking with @if directive like this.

@if(auth()->guest())
    // user login.
@endif

But Blade gives us a directive called @guest. That's exactly what works and you're writing cleaner code.

@guest
    // user login.
@endguest

There is also a usage that we can say show this if she is not logged in like this, and show that if she is logged in

@guest
    // user login.
@else
    // user not login.
@endguest
Comments

There are no comments, make the firs comment