Laravel 5.1 Route groups

I have the following Route::group setup in my routes.php file. The problem is that I now want to add a new route Route::post('/timesheets/new', 'TimesheetTimesheetController@create'); but the problem is the controller is located in a different directory and therefore, the namespace on the group is causing Laravel to look for the controller in the same directory.

My Route::group

Route::group(['middleware' => 'admin', 'prefix' => 'admin', 'namespace' => 'Admin'], function ()
{
    Route::get('/', 'DashboardController@index');
    Route::get('/contractors', 'ContractorController@index');

});

I want to add this:

Route::get('/timesheets/new', 'TimesheetTimesheetController@index');

However, when I do this, I get the error:

Class AppHttpControllersAdminTimesheetTimesheetController does not exist


Source: laravel

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.