Laravel 5.1 View not found

19,642

Solution 1

Turns out I had spelt blade incorrectly, took a second pair of eyes to notice it though.

$ ls resources/views/crud/booking/
crud.balde.php  index.balde.php

Was definitely a lesson to always double check the small things when debugging. Thanks for the help.

Solution 2

Please use terminal

homestead ssh > Press Enter
vagrant@homestead cd /Path_of_Your_Project/
vagrant@homestead:~/Path_of_Your_project php artisan cache:clear
vagrant@homestead:~/Path_of_Your_project php artisan config:cache

Sorry about my English

Solution 3

For someone who don't have SSH Access, There are two ways to solve this problem.

If you don't have any plugin of default Laravel package, First, Just remove the bootstrap/cache/config.php to solved the file,

OR

If you have any plugin of default Laravel package, Change all related path mentioned bootstrap/cache/config.php into the exact path which allocated the laravel project.

Solution 4

Remember that Linux is case sensitive!

I had something like this:

return view('MyView', $data);

And it was working on my environment (Mac OS), but not on the deployment server (Ubuntu)!

Share:
19,642

Related videos on Youtube

Livewire
Author by

Livewire

I am a developer at heart and love to create and contribute to projects. I originally started development with basic XHTML and moved to PHP where I got my first glimpse of the true power of application and software development.

Updated on September 14, 2022

Comments

  • Livewire
    Livewire over 1 year

    this seems to be an issue that pops up every now and then within Laravel. I was writing a CRUD controller with a view to go with it, however upon testing I got the InvalidArgumentException in FileViewFinder.php line 137: View [bookingcrud.index] not found error. Here is my code:

    routes.php:

    Route::resource('bookingcrud', 'BookingsCrudController');
    

    BookingsCrudController.php

    use uasc\Http\Requests;
    use uasc\Http\Requests\CrudCreateRequest;
    use uasc\Http\Requests\CrudUpdateRequest;
    use uasc\Http\Controllers\Controller;
    
    use Auth;
    use DB;
    use Illuminate\Pagination\Paginator;
    
    use Illuminate\Http\Request;
    
    class BookingsCrudController extends Controller {
    
        public function index()
        {
            if (!Auth::check() || Auth::user()->authority < 1) {
                return redirect('/login');
            }
    
            $raw = "select * from bookings";
            $bookings = DB::select($raw);
            $paginatedBookings = new Paginator($bookings, 1);
    
            return view('bookingcrud.index')->with('bookings', $paginatedBookings);
        }
    }
    

    And a view located in ~/laravel/resources/views/bookingcrud/index.blade.php No matter what is in this view file whether its markup from a working view or just the word "cheese" i will always get:

    InvalidArgumentException in FileViewFinder.php line 140:
    View [bookingcrud.index] not found.
    

    I tested the same view in a known working controller and got the same error however I tested a known working view on the same CRUD controller and it worked. I have also tried changing the directory of the view and renaming it but i'll get the same error with the "View [bookingcrud.index]" changing appropriately. I made sure the permissions of the file and directories were full for testing.

    Since first getting the error I have upgraded to 5.1.1 from 5.0.26 (which is the version the error originated on for me) and ran composer update. Also from looking at threads with the same error I have also ran artisan config:clear

    I am developing on Windows 8.1 with Homestead 2.0.17 deployed with Virtual Box.

    Any help would much appriciated at this point it is doing my head in.

  • Amir Khan
    Amir Khan over 4 years
    You have made my day, i was facing the same issue. The site was working fine on my localhost, but it displayed "invalidargumentexception" about view not found. I tried many solution but your one worked fine. Thanks,