Module Creation In laravel5 PHP Framework

In this tutorial we will learn Module Creation and how to manage structure in Laravel5. In the laravel 5 framework we can create modules which is helpful for modular programming.
For the creation of module we need to develop Modules folder inside the root/app/ directory.
Now we have to create directory for module link app/Modules/Blog. Inside that need to be create three directory controller, model, view and one route.php file.
Before creation of these have to create module.php file inside config/module.php and mention below code over there:

Inside app/Module/Blog/Controller create one class BlogController.php as controller which are as:

Now need to create model inside Inside app/Module/Blog/Model create one model class BlogModel.php as model like below:

Inside Blog/Views/ directory create index.blade.php for display which will be pass by controller.

After that you have to set routing of the module in route.php which is available in app/Modules/Blog/route.php.

Above route code will open your module on following url :

Leave a Reply

Your email address will not be published. Required fields are marked *