Iulian Oancea
Iulian Oancea

Reputation: 11

Laravel model not routing to the view

I created a new model called ProjectsController and want to have it route to views/projects/index.blade.php.

This is my ProjectsController code:

class ProjectsController extends Controller
{
    public function index() {
        return view('projects.index');
    }
}

And the path is correct for the file as in resources/views/projects/index.blade.php.

However, my /projects page gives this error: "View [projects.index] not found."

Route web.php is: Route::get('/projects', 'ProjectsController@index');

Upvotes: 0

Views: 78

Answers (1)

James Allen
James Allen

Reputation: 1019

ProjectsController is a Controller, not a Model just FYI. Definitely check the docs for further clarification there.

Please confirm that you have your view in the right place and named correctly like so:

/resources/views/projects/index.blade.php

I have never seen Laravel throw a View not found error when the view is present in the correct location.

Upvotes: 1

Related Questions