We are working on a Stock Management app. The core Laravel has the default functionalities. Now we're creating some advance modules for it using this package and it works very well. I need some architecting ideas which can simplify some of our tasks.
Basically how to manage intercommunication between modules?
Right now, we have conditional blocks to check if the module is enabled then show the field for it, but feels like there should be some better way to do it.
Looking forward to hearing from you.
Thank you in advance.
@renanBritz Yes, good point. But for displaying forms fields based on modules, I think to check if a module is enabled or not is the only option. Or do you know some effective way to handle it?
Indeed events are the way to decouple modules for business logic.
In asgardcms I added a helper to check if a module is enabled, could help you maybe: https://github.com/AsgardCms/Platform/blob/3.0/Modules/Core/helpers.php#L26
@nWidart yes this is very helpful, Thanks for sharing.
For views based on modules - do you recommend the having to check in view if modules are enabled or not and based on that show form fields? Or some better way?
not sure I follow. Do you want to include a view partial from a module?
You can check if a module is enabled if so, include its view for example.
An implementation example: https://github.com/AsgardCms/Platform/blob/3.0/Themes/Adminlte/views/layouts/master.blade.php#L92
However, this isn't ideal to keep modules decoupled. But as always, there are tradeoffs, sometimes it's worth it.
This is what I was looking for. Thank you.
I'll close this as there hasn't been a reply in a while, feel free to comment if needed.
Most helpful comment
not sure I follow. Do you want to include a view partial from a module?
You can check if a module is enabled if so, include its view for example.
An implementation example: https://github.com/AsgardCms/Platform/blob/3.0/Themes/Adminlte/views/layouts/master.blade.php#L92
However, this isn't ideal to keep modules decoupled. But as always, there are tradeoffs, sometimes it's worth it.