Skip to content

Add laravel default exception blade files to view:cache#53353

Merged
taylorotwell merged 4 commits into
laravel:11.xfrom
samuelwei:cache-default-exception-views
Oct 31, 2024
Merged

Add laravel default exception blade files to view:cache#53353
taylorotwell merged 4 commits into
laravel:11.xfrom
samuelwei:cache-default-exception-views

Conversation

@samuelwei
Copy link
Copy Markdown
Contributor

@samuelwei samuelwei commented Oct 30, 2024

Fixes #53336

This PR adds the path of the default exception blade views to the view:cache command

@samuelwei samuelwei changed the title Create cache for laravel default exception blade files Add laravel default exception blade files to view:cache Oct 30, 2024
*/
protected function registerExceptionRenderer()
{
$this->loadViewsFrom(__DIR__.'/../Exceptions/views', 'laravel-exceptions');
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need this when app.debug=false?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This error page is only available with app.debug=true:
image
The views for that are cached with the namespace 'laravel-exceptions-renderer', (a few lines below the added code)

However if app.debug=false the following page is rended:
image

These views, also used for abort(404), etc. are stored in the path I added with this PR to the view:cache command, as they are always shown, independent of the app.debug value

These views can be overridden, see https://laravel.com/docs/11.x/errors#custom-http-error-pages

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Default execptions are not precompiled using view:cache

3 participants