Home > Article > Backend Development > How to organize and implement Laravel5.1 three-tier structure directory
As the title says, I have been learning laravel recently, but I found that many video tutorials only talk about the directory structure of Model and Controller, but I think it is easier to manage and maintain with Dao and Service similar to Java, but I don’t know how to organize it as a newbie. , and I plan to apply Laravel to my new project, does anyone know about it
As the title says, I have been learning laravel recently, but I found that many video tutorials only talk about the directory structure of Model and Controller, but I think it is easier to manage and maintain with Dao and Service similar to Java, but I don’t know how to organize it as a newbie. , and I plan to apply Laravel to my new project, does anyone know about it
Because the tutorial is just a code example and does not involve complex business logic.
PHP is currently not the best solution for large-scale projects. The main purpose is to be short and fast, so MVC is basically enough, and related logic processing is generally integrated into the Model layer.
If your business logic is quite complex and you don’t want the Model class to expand too much, you can also separate the business logic. It is generally recommended to create a related Repository class. The tutorial is here: https://laravel.com/docs/5.2 /...
PS: Code organization is all about finding a balance among changes, so it is still important to have an IDE for reconstruction
I also created related Repository
Reference: https://github.com/bestmomo/l...