Laravel 5.2 Auth :: check()异常页面(布局)

时间:2016-04-25 07:15:03

标签: php laravel exception laravel-5.2

当我中止(404)时,Laravel 5.2会返回一个错误页面。但是当我通过dump()方法调用Auth :: user()的Auth :: check()时,它返回null。

但是我想在屏幕上显示当前登录用户的自定义错误页面(例如我在菜单中的layouts / app.blade.php中:Goodmorning username )。 / p>

我尝试在app / exceptions / handler.php上启用网络中间件但是没有用。

Anny的建议?

1 个答案:

答案 0 :(得分:0)

你可以add custom error message

abort(404, 'ow noo, error 404'.Auth::user()->id);

在错误页面中:

{{ $exception->getMessage() }}