loading...

re: The best Laravel repositories solution in 30 lines of code VIEW POST

FULL DISCUSSION
 

If you are mostly interested in creating custom functions to attach to your Models then you could just use scopes. E.g. laravel.com/docs/5.8/eloquent#loca...

 

Scopes are a good way to create custom query functions indeed. Still, I don't think this should be part of an instance of a Product entity though. When an instance of a Product has a method called 'findByName' it is in the wrong place in my opinion.

code of conduct - report abuse