Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

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);
    });
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #user #detail #constructor #Laravel
ADD COMMENT
Topic
Name
8+2 =