Reputation:
If the user access to a page that exist for example the conference details page "https://project.test/conference/1/conference-test" it works fine.
If the user acces a page that dont exist for example "https://project.test/test" it appears the default message of the 404.blade.php. But do you know how to show the header and the footer of the site and the 404 message in the content?
I have a template file like:
<!doctype html>
<html lang="{{ app()->getLocale() }}">
@include('partials.head')
@yield('styles')
</head>
<body>
@include('partials.header')
@yield('content')
@include('partials.footer')
@yield('scripts')
</body>
</html>
Upvotes: 0
Views: 624
Reputation: 774
By default Laravel handles error and uses the error code to return view.
ex: (Error 404 will return resources/views/errors/404.blade.php
)
Laravel makes it easy to display custom error pages for various HTTP status codes. For example, if you wish to customize the error page for
404
HTTP status codes, create aresources/views/errors/404.blade.php
. This file will be served on all404
errors generated by your application.
You can read more about it here
To display header and footer in that view, you need to create the file and include the header and footer view just like what you did in other view.
Upvotes: 1