Skip to content
Advertisement

Getting Controller does not exist after moving my controller to sub folder in laravel 5

I have created a resource full route which was pointing to a CRUD controller in App/Http/Controller/SeatController.php my Route in api.php

Route::resource(‘websites’, ‘SeatController’);

I wanted to put all controllers related to Seat inside a directory. I created a directory named Seat and I moved all of my controllers related to Seat to it. it’s path is : AppHttpControllersSeatSeatController

before change it’s path was : AppHttpControllersSeatController

After above changes I added Seat directory name to my resource full route like :

JavaScript

But when I’m reaching this controller I get below error message :

JavaScript

UPDATE : my SeatController.php file is like :

JavaScript

When I change it to :

JavaScript

I Get this error message :

JavaScript

any one knows how to fix this ?

Advertisement

Answer

Class AppHttpControllersSeatSeatController does not exist

This means controller can not find out the SeatController class. You should check following steps. Hope this will be worked for you.

First you have to check model call in your SeatController file is ok or not. And then check your namespace in SeatController is ok or not. Try with Something like below:

JavaScript
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement