Services and Repositories in Laravel: DayByDay CRM Example

preview_player
Показать описание
How/when to use Services and Repositories in Laravel? Let's take a look at the example from one open-source project.

- - - - -
Рекомендации по теме
Комментарии
Автор

Each developer has their own opinion about what repositories should do.
For me, repositories in Laravel is like a Bookcase. It can't save or update anything - that's should do services. Repositories just give me beauty way to get data from database, api etc... and hide that logic and queries from controller. Just like bookcase :)
For example:




Not in laravel it can have logic to update or save anything, but we have Eloquent and don't need that.

romansarvarov
Автор

let's support this awesome channel.

ivon
Автор

There is a major problem with the currency repository, in particular the storing of static values for the vatPercentage. The VAT rate can change and with the current implementation it's not possible the maintain the changes. For example, the VAT rate in the UK is 20%, so If the VAT rate changes in the future to 25% it won't be possible to create invoices prior to the change as the new rate will overwrite the old one.

johnp
Автор

Hello Povilas. Thank you for your videos. Quick question. in the open source version, can you add and delete users(couldn't find it in the code base)? When I tried to add a user, it said max number of users reached so I changed that code to read if >= {... and it worked but there has to be a better way, right?

siriusly
Автор

Hello brother, how can I cache any domains information of each dynamic pages using laravel backend, Please give a some idea.

suryadeepbhujel
Автор

Hello Povilas, Is there a problem of having the service classes instantiated in the controller constructor instead of using

TheAstroguypasa
Автор

I am using both in my projects. I was asked to do work in pre built code by another developer from another region. I was reviewing code, there he used ENTITY PATTERN also. What's the exact need of that? I found that it contains setter and getter of each and every property (table column) and also some other stuff. Also instead of Interfaces (Repository Pattern) i have used Abstract Classes for parent to have its own methods for DRY and abstract methods to override in children classes. Kindly share your thoughts. Thanks and Respect from Pakistan 🇵🇰

nabeelyousafpasha