Вопрос

when there is some error in view, L4 shows a nice trace, but cached filename: open: /var/www/webpage/app/storage/views/1154ef6ad153694fd0dbc90f28999013

howto during view-rendering-to-cache save view's path/name (in a comment or something)? Or better yet - to show it in the debug-error-page (its called whoops or something?)

Thanks ;)

Это было полезно?

Решение 3

One way to tackle this problem is add a html comments (not blade ones as they will not be rendered in compiled view) in sections which get echoed.

@section('content)

<!-- FILE: app/views/main/index.blade.php -->

<Your Content Goes Here>

@stop

This html comment will get rendered in the compiled source of the view. Of course you will have to inspect the compiled view first to identify which view is the problematic one. But in my experience, this method work almost all the time.

Другие советы

This is not exactly a problema, this is a compiled version of your view.

Laravel Blade System will compile all your views and subviews into a single file and, if you didn't change anything on them it will always try to use the compiled version, to speed up your system.

Sometimes is hard to know wich one of our views is related to that error. Using Sublime text, what I do is to hit CTRL-P (windows) and paste the number of the compiled view (1154ef6ad153694fd0dbc90f28999013) and it will bring it to me right away.

Of course, you won't do any changes on it. This is just way to find the view you have problems in, so you can then find the real file and fix it. If you know wich file is the problematic one, you don't have to do this, go directly to your file.

I don't know how to de encrypt view names , but one method i do is to

{{dd('will you reach here ')}}

Trying to move this line from view to another to watch where php render reach .

I know it is not the right way nor the professional one , but it may help in some cases .

I created a helper that checks to see if you are working locally or in development mode, It then outputs an HTML comment.

{{ printViewComment('mockup/reports@content') }}

<!-- Template: mockup/reports@content -->

I chose to name the comments like this path.file_name@yeild_name but I only wish this was an automated featured.

I found my answer after looking into source, when on the Whoops! page, just look for render in the sidebar, there will be the name of the view file...

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top