Reputation: 1424
I want to separate my controllers into two different folders BackEnd and FrontEnd, but when I do it shows an error:
Class App\Http\Controllers\CredentialsController
does not exist. This credentialscontroller is inside BackEnd folder so I changed the namespace to namespace App\Http\Controllers\BackEnd;
and also added use App\Http\Controllers\Controller;
so that it still extends the base controller in the CredentialsController then I used composer dump-autoload but it's still not working. It shows the same error. Also I have tried adding this to my composer.json just to check if it works and it still throws the same error.
"autoload": {
"files": [
"App\Http\Controllers\BackEnd\CredentialsController.php"
]
},
All I want to do is separate my controllers for BackEnd and FrontEnd.
Upvotes: 1
Views: 93
Reputation: 51
You must include Namespace in route, namespace are mapped as folder path Route::resource('credentials', 'BackEnd\CredentialsController');
Upvotes: 0
Reputation: 152860
You probably still have to adjust the namespace where you actually use the controller.
For example in a route:
Route::resource('credentials', 'BackEnd\CredentialsController');
Upvotes: 2