Before I have written blog how to add sub-folder in our controller but not mention that how we will do Controller sub-folder routing.As we all know that routing plays an important role in any project. In Laravel 4.x sub-folder routing can be done in following way.
Example:To try and keep my app organized I would like to put my controllers into sub-folders of the controller folder.
controllers\
---- folder1
---- folder2
I tried to route to a controller, but laravel doesn't find it. That is the query and the solution is:
Step 1:
Add your controllers in your folders:
controllers\
---- folder1
---- folder2
Step 2:
Create your route not specifying the folder:
Route::get('/product/dashboard', 'MakeDashboardController@showDashboard');
Step 3: Run the following command
composer dump-autoload
By this way we can do controller sub-folder routing.
0 Comment(s)