I've created a section of the menu where if a customer is logged in then the section changes. The problem I'm having is that it doesn't change. It stays as if the customer is logged in even if I log out.
The section of my menu
<ul class="dropdown-menu">
@if(Auth::guard('customer_admin')->check())
<li><a href="#">User Profile</a></li>
<li role="separator" class="divider"></li>
<li><a href="{!! route('logout') !!}">Logout</a></li>
@else
<li><a href="{!! route('client.signup') !!}">Sign up</a></li>
<li><a href="{!! route('login') !!}">Login</a></li>
@endif
</ul>
My CustomerAuth.php middleware
<?php
namespace App\Modules\Customers\Http\Middleware;
use Closure;
use Auth;
class CustomerAuth
{
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next, $guard = 'customer_admin')
{
if(!Auth::guard($guard)->check())
{
return redirect()->to('login')->with('warning', 'Access Denied');
}
return $next($request);
}
}
via Isis