当我中止(404)时,Laravel 5.2会返回一个错误页面。但是当我通过dump()方法调用Auth :: user()的Auth :: check()时,它返回null。
但是我想在屏幕上显示当前登录用户的自定义错误页面(例如我在菜单中的layouts / app.blade.php中:Goodmorning username )。 / p>
我尝试在app / exceptions / handler.php上启用网络中间件但是没有用。
Anny的建议?
答案 0 :(得分:0)
abort(404, 'ow noo, error 404'.Auth::user()->id);
在错误页面中:
{{ $exception->getMessage() }}