i'm used to write a lot in codeigniter, where i try to place all logic code inside libraries instead of controllers.
The idea is a controller calls a library that calls a model to get data. So whatever is happening inside a library, can be called from multiple controllers easily, without rewriting code.
Now i'm baby stepping to laravel and i cannot find anything about custom libraries. I perfectly managed to call a model from a controller, but I want to have a controller calling a library and the library calling the model.
I'm not able to find libraries (not packages), do they exist in laravel ?
Thank you.
Laravel works with Services and Providers, you create your service and write a provider for it. Laravel Providers
Also you can have Services Directory which is served through Providers Directory.
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