Answers for "get the user detail inside the constructor Laravel"

PHP
0

get the user detail inside the constructor Laravel

public function __construct(){      
    $this->middleware(function ($request, $next) {      
        if(auth()->user()->hasRole('frontuser')){
            return redirect()->route('home')->withFlashMessage('You are not authorized to access that page.')->withFlashType('warning');
        }
        return $next($request);
    });
}
Posted by: Guest on October-05-2021

Code answers related to "get the user detail inside the constructor Laravel"

Browse Popular Code Answers by Language