Laravel 5.5 – New Blade Directives , @auth and @guest

As part of Laravel 5.5 version release, Laravel introduced new blade directives called @auth and @guest.As the name implies both can be useful to determine if the current user is authenticated or guest.

In the previous versions of Laravel to check user authentication status we’d used @if directive with the combination of Auth()->check(). But the new directives makes code lot cleaner, lets see how we can use them.

@auth and @guest

Now we can quickly check if the current user is authenticated or is a guest:

old way of auth status check

By Arjun

I am Arjun from Hyderabad (India). I have been working as a software engineer from the last 7+ years, and it is my passion to learn new things and implement them as a practice. Aside from work, I like gardening and spending time with pets.

Leave a Reply

Your email address will not be published. Required fields are marked *