I have created a custom guard called 'business_user' in my Laravel app by adding the provider into my auth.php file.
'providers' => [
'users' => [
'driver' => 'eloquent',
'model' => App\User::class,
],
'business_users' => [
'driver' => 'eloquent',
'model' => App\BusinessUser::class,
],
],
In my blade template I have some custom code which display different content depending on the user that has logged in.
@if (Auth::check('business_user'))
<a class="btn btn-light" href="{{ route('user.logout') }}">Logout Business</a>
@elseif(Auth::check())
<a class="btn btn-light" href="{{ route('user.logout') }}">Logout Customer</a>
@else
(Guest user)
@endif
Whether I am logged in as a normal user OR the a business user the blade template always shows the first condition (Logout Business).
I have verified the correct user guard is logged in because I can verify this checking the session variable names in my laravel debug bar.
Can anyone explain why?