Timothy Kruger Timothy Kruger - 6 months ago 63
PHP Question

View [shared.view] not found. (View: 'dir') in laravel 5.4 on local machine

Please help with the query mentioned in the subject line, I've tried the following:

<!-- https://stackoverflow.com/questions/42505607/laravel-5-4-view-name-not-found -->
php artisan cache:clear
php artisan config:cache

<!-- https://laracasts.com/discuss/channels/general-discussion/view-home-not-found?page=1 -->
php artisan route:clear
php artisan cache:clear
composer update

<!-- Partial view folder structure -->
- fares-and-payments.blade.php (this is the view that includes wc-fares-and-payments.balde.php)
- shared
-- rail-routes.blade.php
-- wc-fares-and-payments.balde.php

@yoeunes gives me the following error when doing php artisan route:cache, wtf haven't touched anything to do with login:

Unable to prepare route [api/user] for serialization. Uses Closure.

I'm running PHP on IIS and not Apache if that helps, and I did notice that IIS was acting strangely last week (giving me HTTP Error 404.0 - Not Found), do you think that maybe sorting the IIS issue might resolve this?

Answer Source

This error also occurs when you try to move the whole project directory to other path. run the following commands:

php artisan optimize --force
php artisan config:clear
php artisan route:clear
php artisan view:clear

also This happens when Laravel doesn't find a view file in your application. Make sure you have a file named: view.blade.php under your resources/views/shared directory.

Note that Laravel will do the following when calling return view('shared.view'):

  • For view('view') Laravel will look for the file: resources/views/view.php.
  • For view('shared.view') Laravel will look for the file: resources/views/shared/view.blade.php.
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download