📌  相关文章
📜  在构造函数 Laravel 中获取用户详细信息 - PHP 代码示例

📅  最后修改于: 2022-03-11 14:53:56.452000             🧑  作者: Mango

代码示例1
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);
    });
}