How to get the current user in a __construct method of controller - 7-Views
How to get the current user in a __construct method of controller
This issue arises because the controller __construct method executes before any middleware. so it returns null when we call
auth()->user()
So the solution of the issue is, inside your Controller __construct method call this.
public function __construct() { $this->middleware(function ($request, $next) { dump(auth()->user()); return $next($request); }); }