Init
This commit is contained in:
19
Career/Resources/Laracast/Modular Laravel.md
Normal file
19
Career/Resources/Laracast/Modular Laravel.md
Normal file
@@ -0,0 +1,19 @@
|
||||
He put everything in a modules folder / namespace. Inside a module the default Laravel structure is use.
|
||||
|
||||
Each module gets a service provider, with a loadMigrationsFrom, mergeConfigFrom and registers other providers.
|
||||
|
||||
Each model gets a route service provider.
|
||||
Each model gets a event service provider.
|
||||
|
||||
Tests are put in the modules and bound in the phpunit.xml. FYI starts are followed
|
||||
'/modules/\*/Test' works. Also add modules specific base test case.
|
||||
|
||||
To bind factory, define model and newFactory method.
|
||||
|
||||
When you need to use models from other modules, instead use Data Transfer Objects which can then be used to encapsulate behaviour.
|
||||
|
||||
Make your dto's readonly and enforce properties to be primitives. When breaking a boundary a easy fix would be to make placeholder class a module and inject it into the other module.
|
||||
|
||||
Then behaviour is put into actions.
|
||||
|
||||
To uncoupling make dto's from your models and start moving all the things you need into those dtos
|
||||
Reference in New Issue
Block a user