php - laravel5.4 prints Auth::check(); in the constructor of the class and returns false, and prints it in the method of the class and returns true
怪我咯2017-05-16 12:58:35
0
2
1131
Help, help! laravel5.4 prints Auth::check(); in the constructor of the class and returns false, and prints it in the method of the class and returns true. Make sure you are logged in
Reason
This problem has existed since Laravel 5.3 started grouping routes. The reason is that the middleware is not running when construct is run.
Solution
function __construct(Request $request)