Auth::user() got null value in module Controller

  • Now, I want to get authenticated user by Auth facade in controller, but I got null value. Maybe I missing some namespace ???

  • Global Moderator

    I would just use Injection of Asgards contract, Auth still points to laravels own implementation.

    For example:

        use Modules\Core\Contracts\Authentication;
        public function index(Authentication $user)
            dd($user->check()); // false or logged in user object

    And namespace for Auth facade would be use Illuminate\Support\Facades\Auth;

Log in to reply

Looks like your connection to AsgardCms was lost, please wait while we try to reconnect.