9

I have upgraded my Laravel project from 5.6 to 5.8 (in my local before deploying to live for the first time).

Both Laravel versions are 5.8.5 installed with the same composer.json

In my local, the error pages (404, 503) are the illustrated ones:

enter image description here

vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/views/illustrated-layout.blade.php

however, in live server

vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/views/minimal.blade.php

enter image description here

What is causing it? I want live to show the illustrated ones too with nice Go Back button.


Tried these but no luck :(

php artisan config:clear
php artisan cache:clear
composer dump-autoload
php artisan view:clear
php artisan route:clear
senty
  • 12,385
  • 28
  • 130
  • 260
  • Have you run `composer update` on local, committed the new `composer.lock`, and run `composer install` on live? – Travis Britz Mar 20 '19 at 20:10
  • yes, I upgraded the project in my local before deploying on live for the first time – senty Mar 20 '19 at 20:11
  • Just to clarify, you *did* run composer install on your live server after the new composer.**lock** was committed? I just want to rule out a simple mistake – Travis Britz Mar 20 '19 at 20:15
  • yes - if I try `php artisan --v` it tells me that it's 5.8.5 both on live and local – senty Mar 20 '19 at 20:18
  • Can you include your `resources/views/errors/404.blade.php`? – Travis Britz Mar 20 '19 at 20:52
  • There is none, which falls back to `/vendor/` – senty Mar 20 '19 at 21:09
  • Maybe your 404 blade view is cached? You can try `php artisan view:clear` on your live server – Travis Britz Mar 20 '19 at 21:56
  • I tried that too, clearing routes, views, routes caches as well as ‘php artisan optimize’ – senty Mar 20 '19 at 22:29
  • I ran `php artisan view:clear` in my local and it changed the illustrated view to minimal view. Then I copy the files from a working project's vendor to view/errors and it worked again. – senty Mar 26 '19 at 14:47

2 Answers2

11

Maybe late, but you could also re-publish the files from the 5.8 version without copying them from 5.7 or creating new ones:

php artisan vendor:publish --tag=laravel-errors

All blade templates should be available again under views/errors.

In the views I just had to change

@extends('errors::minimal')

into

@extends('errors::illustrated-layout')

and add

@section('image')
<div style="background-image: url({{ asset('/svg/403.svg') }});" class="absolute pin bg-cover bg-no-repeat md:bg-left lg:bg-center">
</div>
@endsection
Constantin
  • 121
  • 1
  • 7
10

It looks like the default 404 error view in vendor/ changed in Laravel 5.8 from the illustrated layout to the minimal layout, perhaps to have a less opinionated default.

I recommend creating your own view under resources/views/errors/404.blade.php if you want the previous view back. You can copy the illustrated view directly from the 5.7 version if that's what you wanted to display: https://github.com/laravel/framework/blob/5.7/src/Illuminate/Foundation/Exceptions/views/404.blade.php

The illustrated layouts are still available, they're just not the default anymore.

Copying the old view is essentially the same as running php artisan vendor:publish --tag=laravel-errors and editing the 5 lines as @Constantin noted, but since the original was only 8 lines of code to begin with it really doesn't matter which method you chose. The basic idea is the same: explicitly define your view in resources/ instead of falling back to the vendor/ defaults supplied by the framework (which may change).

Travis Britz
  • 5,094
  • 2
  • 20
  • 35