3

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
Christian Giupponi
  • 7,408
  • 11
  • 68
  • 113

1 Answers1

0
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

Reshma R P
  • 11
  • 8