get the user detail inside the constructor laravel

Solutions on MaxInterview for get the user detail inside the constructor laravel by the best coders in the world

showing results for - "get the user detail inside the constructor laravel"
Matthieu
17 Jan 2021
1public function __construct(){      
2    $this->middleware(function ($request, $next) {      
3        if(auth()->user()->hasRole('frontuser')){
4            return redirect()->route('home')->withFlashMessage('You are not authorized to access that page.')->withFlashType('warning');
5        }
6        return $next($request);
7    });
8}
9
similar questions