Laravel dedicated builder object

5/20/2019
· 1 min read

🍭 Want to thin out your @laravelphp models? You can relocate scopes to dedicated builder object.

Gain:
✅ Thinner models
✅ Click through in your editor
✅ Static analysis (if that's ur bag)

Lose:
❎ Having every co-located

Step 1: Make a custom builder

step1

Step 2: Return your dedicated builder from the newEloquentBuilder method on your model.

📌 Scopes on your model will continue to function, so you can progressively refactor if you need.

step2

Enjoy!

enjoy

From @timacdonald87.

You can find this page with theses search keywords:

/ model / scope / query /
Mathieu TUDISCO
Thanks for reading!
I'm Mathieu TUDISCO, a lead developer at Linkvalue .
You can find me anywhere with @mathieutu.
As a start you can follow me on Twitter or want to find out more about me or the blog.