Authenticate user with Blade?

Curious if there’s a better way to authenticate users using Blade.

The traditional way to check if a user is logged in or not to display certain information goes like this:

<?php if ( is_user_logged_in() ) { ?>You're logged in. Log out.<?php } ?>

Some Blade documentation suggests:

@if (Auth::check())
  //show logged in navbar 
  //show logged out navbar

Or Blade 5.7+ suggests:

// The user is authenticated...

// The user is not authenticated...

Perhpas these methods aren’t configured with Sage to work with WordPress? Or are there other suggestions better than all I listed?

Not all parts of Blade are in Sage, like the ones you’ve listed.

Checkout @Log1x sage-directives package which has something similar:


That’s very awesome, thanks for the reference.

This topic was automatically closed after 42 days. New replies are no longer allowed.