Laravel, Auth::user() in controller

后端 未结 9 1792
说谎
说谎 2021-02-20 11:44

Laravel framework- Why aren\'t I able to use Auth::user(), (to see if user has been logged in) in the controller of the laravel project. Is the Session not connected to the cont

9条回答
  •  -上瘾入骨i
    2021-02-20 12:10

    The problem is that you haven't included the Auth facade.

    In your HomeController.php do:

    use Illuminate\Support\Facades\Auth;
    

提交回复
热议问题