Home /

Blog

Filtered on: Scopes Unset

Blog

My random ramblings

Below you can read various blog posts about Laravel, Vue.js or other techniques. That depends on my mood.

Loading blogposts...

Scopes to custom QueryBuilders

As you might be aware, reusing certain query scopes is fairly straightforward using Local scopes. But it feels a bit dirty to bother our models with this logic, especially since every function has to be prefixed with scope. Fortunately, there is an easier way to define these reusable scopes using separate QueryBuilder classes.