Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make HMVC In Laravel 5?

Tags:

php

laravel

hmvc

I have finished my previous project in yii2. Now, I'm currently working on laravel 5. I am new to laravel 5. I have googled about HMVC in laravel but I haven't found an appropriated answer (ie package) on Laravel. In Yii2 it provided by default .But I have not found in Laravel .Please suggest me How I work moduler way in Laravel 5.

like image 586
nirajan poudel Avatar asked Jun 09 '15 15:06

nirajan poudel


People also ask

What is HMVC in Laravel?

HMVC is a real effective design pattern and has been widely used, however among Laravel's community, this design pattern is considered somehow a “bad practice”. In his book From Apprentice to Artisan, Taylor Otwell – Laravel Framework Author- suggests: HMVC is usually an indicator of poor design.

What is HMVC CodeIgniter?

In CodeIgniter HMVC, HMVC stands for Hierarchical Model View Controller. It is a further new version of the MVC pattern used for web applications. Providing solutions to many problems it helps you solve the scalability of applications.

What is module in Laravel?

Module is like a Laravel package, it has some views, controllers or models. This package is supported and tested in Laravel 5+. The nwidart/laravel-modules package is a re-published, re-organised and maintained version of 'pingpong/modules', which isn't been maintained anymore. For more information about this package.


1 Answers

You can achieve this by using namespaces and grouping routes. Look at my screenshot:

screenshot

As You can see I've 2 top level namespaces: Panel, Site. It's not problem to make controllers with namespace SomeApp, SomeAnotherApp and group their routes. using Route::group.

also read this discussion: https://laracasts.com/discuss/channels/requests/multiple-modules-in-laravel-5?page=1

like image 85
num8er Avatar answered Sep 28 '22 05:09

num8er