Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Laravel default error pages are different in server [minimal.blade vs illustrated.blade]

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
like image 565
senty Avatar asked Mar 20 '19 18:03

senty


People also ask

Where is error page in laravel?

In your Laravel project folder, create a folder called “errors” in your /resources/views/ folder.

How do you do error reporting in laravel?

Through your config/app. php , set 'debug' => env('APP_DEBUG', false), to true . Or in a better way, check out your . env file and make sure to set the debug element to true.


2 Answers

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
like image 193
Constantin Avatar answered Nov 15 '22 04:11

Constantin


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).

like image 34
Travis Britz Avatar answered Nov 15 '22 03:11

Travis Britz