Laravel 5.3 auth check in constructor returning false

前端 未结 3 670
Happy的楠姐
Happy的楠姐 2020-11-27 21:07

I\'m using Laravel 5.3 and I\'m trying to get the authenticated user\'s id in the constructor method so I can filter

3条回答
  •  北荒
    北荒 (楼主)
    2020-11-27 21:45

    Since 5.3 Auth::check will not work in a controller's construtor, it's one of undocumented changes. So, you need to move it to middleware or do check in controller methods instead or move project to 5.2.x.

提交回复
热议问题