Laravel 5.4 | Custom Page for NotFoundHttpException
Laravel will render your error pages before falling back on the default view.
If your view is created in: resources/views/errors/404.blade.php
. This page will be rendered before the fallback error page.
The views in the above directory should have the names of the HTTP status code which you are trying to render.
More information can be found in the laravel docs:
Just create your view here
resources/views/errors/404.blade.php
Laravel will serve it automatically for you
You do not need to modify the render function. Keep it like the original:
public function render($request, Exception $exception){ return parent::render($request, $exception);}
All you have to do is just make the view:
resources/views/errors/404.blade.php
Then add some contents to the file, for example:
@extends('layouts.app')@section('content')404@endsection
Laravel takes care of the rest...