Share on Facebook0Tweet about this on Twitter0Share on Google+0Share on TumblrEmail this to someone

If you like to put your controllers, models and views folders within one folder in Laravel 4.2. Here is the simplest way :

First Create folder “modules” (your desire directory name) in root directory and Create directories and files under modules. Your directory structure should like this:


Update path of controllers and models in composer.json

"autoload": {
 "classmap": [

Put the following code in app/start/global.php

View::addNamespace('admin', app('path').'/../modules/views/admin/');
View::addNamespace('frontend', app('path').'/../modules/views/frontend/');

then run

'php artisan dump-autoload' or 'composer dump-autoload' 

Remember whenever you create new file in modules you need to run above command.