I want to write a separate exception handler
for one Laravel5
package, such that it displays the custom 404
view of that package.
Actually I want to know how should I register the Exception Handler
of a package inside the provider of that package.
For example, if name of my package is testPackage
, my ExceptionHandler
file is located in :
vendor/testPackage/src/Exceptions/testExceptionHandler.php
And the 404
view file is located in :
vendor/testPackage/src/views/404.blade.php
public function render($request, Exception $e)
{
if($e instanceof NotFoundHttpException)
{
return response()->view('missing', [], 404);
}
return parent::render($request, $e);
}
add this code in your testExceptionHandler.php