3

我想exception handler为一个包编写一个单独的Laravel5包,以便它显示该404包的自定义视图。
实际上我想知道我应该如何在Exception Handler该包的提供者中注册一个包。

例如,如果我的包的名称是testPackage,我的ExceptionHandler文件位于:

vendor/testPackage/src/Exceptions/testExceptionHandler.php

404视图文件位于:

vendor/testPackage/src/views/404.blade.php
4

1 回答 1

0
public function render($request, Exception $e)
{
if($e instanceof NotFoundHttpException)
{
    return response()->view('missing', [], 404);
}
return parent::render($request, $e);
}

将此代码添加到您的 testExceptionHandler.php

于 2015-06-24T06:05:29.113 回答