DEV Community

Discussion on: The best Laravel repositories solution in 30 lines of code

Collapse
 
dj_syclone profile image
Dj Syclone

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...

Collapse
 
mratiebatie profile image
Sjors van Dongen

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.