Because laravel frame abnormality is through App \ Exceptions \ Handler class processing, comparison operators may use the instanceof determines whether a specific exception, the render method override class, as follows:
public function render($request, Exception $exception) { / * Error page * / if ($exception instanceof NotFoundHttpException) { $code = $exception->getStatusCode(); if (view()->exists('errors.' . $code)) { return response()->view('errors.' . $exception->getStatusCode()); } } return parent::render($request, $exception); }
Then create a directory in the views directory errors in the catalog and then create a 404.blade.php page template, so then there you can use our own custom 404 page when a 404 error!