I am working with Laravel 5.1 in an app that is already working, but I am changing from modules to the repository pattern.
"psr-4": {
"app\\": "app/",
"Cms\\": "app/cms"
}
The first is the default namespace and the second is what I am changing and passing to said folder. When I call a controller inside app/cms I get the following error:
Class app\Http\Controllers\CalendarioController does not exist
It's like it never looks in app\cms.
Route::group(['namespace' => 'Calendario'], function() {
Route::resource('calendario', 'CalendarioController');
});
and the controller namespace as:
namespace Cms\Calendario;
Thanks for your help!
Although I don't know how your RouteServiceProvider is, it is most likely that with the code you show for the route group you are adding a second namespace to the one that already exists in RouteServiceProvider.
The correct way according to the Laravel documentation would be to add another namespace in the RouteServiceProvider and preferably another routes file (as it is done in Laravel 5.3):