Crud: Errors since updating to V4: ErrorException (E_ERROR) View [layout] not found.

Created on 24 Oct 2019  路  5Comments  路  Source: Laravel-Backpack/CRUD

Bug report

What I did

Since updating to Backpack V4, each time I have an error I get the following message:

ErrorException (E_ERROR)
View [layout] not found. (View: /resources/views/errors/layout.blade.php)

What I've already tried to fix

I've isolated the error to the following line of code in errors/layout.blade.php:

@extends(backpack_user() && (starts_with(Request::path(), config('backpack.base.route_prefix'))) ? 'backpack::layout' : 'backpack::layout_guest')

I've also triple-checked the upgrade guide to make sure I didn't miss anything.

I've spent about 4 hours trying to figure this out and I'm feeling pretty stupid right now. I'm quite certain I'm doing something boneheaded, so please...someone...throw me some wisdom!

Backpack, Laravel, PHP, DB version

PHP 7.2.16
Laravel 6.2.0
Backpack 4.0.12
MySQL 5.7.28

triage

Most helpful comment

Thank you @martijnb92 - I didn't have any custom views but your reply led me to the problem. The old V3 "resources/views/errors" folder from Backpack Base was the problem. Seems like publishing the files during the upgrade didn't overwrite the old error views...not sure why.

If anyone else comes across this issue, overwrite the first line in layout.blade.php. The code should look like this:

@extends(backpack_user() && (starts_with(\Request::path(), config('backpack.base.route_prefix'))) ? 'backpack::layouts.top_left' : 'backpack::layouts.plain')

All 5 comments

Hello there! Thanks for opening your first issue on this repo!

Just a heads-up: Here at Backpack we use Github Issues only for tracking bugs. Talk about new features is also acceptable. This helps _a lot_ in keeping our focus on improving Backpack. If you issue is not a bug/feature, please help us out by closing the issue yourself and posting in the appropriate medium (see below). If you're not sure where it fits, it's ok, a community member will probably reply to help you with that.

Backpack communication mediums:

  • Bug Reports, Feature Requests - Github Issues (here);
  • Quick help (_How do I do X_) - Gitter Chatroom;
  • Long questions (_I have done X and Y and it won't do Z wtf_) - Stackoverflow, using the backpack-for-laravel tag;

Please keep in mind Backpack offers no official / paid support. Whatever help you receive here, on Gitter, Slack or Stackoverflow is thanks to our awesome _awesome_ community members, who give up some of their time to help their peers. If you want to join our community, just start pitching in. We take pride in being a welcoming bunch.

Thank you!

--
Justin Case
The Backpack Robot

Make sure you remove any custom views from the v3 version and republish the new error blade files.That solved this issue for me.

Thank you @martijnb92 - I didn't have any custom views but your reply led me to the problem. The old V3 "resources/views/errors" folder from Backpack Base was the problem. Seems like publishing the files during the upgrade didn't overwrite the old error views...not sure why.

If anyone else comes across this issue, overwrite the first line in layout.blade.php. The code should look like this:

@extends(backpack_user() && (starts_with(\Request::path(), config('backpack.base.route_prefix'))) ? 'backpack::layouts.top_left' : 'backpack::layouts.plain')

This probably should have been posted on Stackoverflow so I'm going ahead and closing it.

Hi @ApexMuse,
I know the issue is closed but I had the same issue when updating from 4.0 to 4.1, you spotted the issue but the line you placed is wrong it should look like this :
@extends(backpack_user() && (Str::startsWith(\Request::path(), config('backpack.base.route_prefix'))) ? 'backpack::layouts.top_left' : 'backpack::layouts.plain')

starts_withwas an old Laravel helpers which was replaced by Str::startsWith

In case you've got the issue, apply this fix or if you didn't customize the views, publish the errors views again.
Hope this helps.

Was this page helpful?
0 / 5 - 0 ratings