I've done the multi-authentication system for admins and it's working fine. But when the admins logged in i want to show their names in the frontend header. I'm using Auth::user()
but it's returning null
even if the user(admins) are logged in. Below is the controller code for front-end
public function __construct()
{
$this->middleware('auth:admin');
}
public function index(){
// return view('frontEnd.homepage');
return dd(Auth::user());
}
and if i don't use the middleware,then i can access the authenticated users(admins). but when admins are unauthenticated, it's preventing the access of the front-end page. how can i fix it ?