I am developing an application using Laravel. However I have question about the modular structure of the application.
Here's an example.
Suppose I need a module called "featured items";
This is a small module that should be included in some controllers.
The thing is I'm not sure how to this? Should this be a new controller which will be called inside other controllers?
Should this be a model? Should this be written as a bundle?
Does anyone have any idea about what is the best approach?
I dont think there's a right answer to this really as it is matter of preference though there are things to bear in mind to let you make an intelligent decision as to where your code should be placed.
Does the module have a small footprint and will function with no more than itself?
Does the module require it's own routes and views but no requirement for libraries?
Does the module contain both the above?
It's not as simplistic, other factors should be taken into consideration as well. If the module requires multiple controllers for example, you'd be better off writing it in a bundle. As bundles do not require you to have anything more than start.php file within the bundle directory, you register what you want with the Autoloader. From this you can see a lot of peoples preferences would be to build all their modular code in bundles.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With