0

When I try to open page that does exists I get the default error message. How can I make 404 page in these cases?

Dev
  • 1,013
  • 7
  • 15
  • 37
  • Possible duplicate of [laravel 5 custom 404](http://stackoverflow.com/questions/26394017/laravel-5-custom-404) – gre_gor Sep 14 '16 at 17:16

3 Answers3

5

Create a new file resources/views/errors/404.blade.php

Style your page whatever you want, Laravel will match HTTP error code with view filename accordingly.

Pete Houston
  • 14,931
  • 6
  • 47
  • 60
2

Lavavel 5.8

If you would like to use Laravel's 404 template, create a file in resources/views/errors/404.blade.php and add this code.

@extends('errors::minimal')

@section('title', __('Not Found'))
@section('code', '404')

@if($exception->getMessage())
   @section('message', $exception->getMessage())
@else
   @section('message', __('Not Found'))
@endif

Then in your controller you can use:

abort(404, 'Whatever you were looking for, look somewhere else');
stillatmylinux
  • 1,399
  • 13
  • 25
-1

Create a new file resources/views/errors/404.blade.php

then use abort(404) in route or controllers.