Source: stefrouschop.nl

When to use Laravel global scopes
Laravel global scopes are great, but I don't see them used a lot. Instead, I see a lot of local scopes being used to achieve the same thing.

But I learned to ask myself this question when I create a local scope: “Will the majority of the queries for this model use this local scope”.

After that, you should let your model be aware of the global scope: get(); Anonymous Global Scopes

Personally, I don't like anonymous global scopes since it can bloat your model if the query is a bit complex.
Newsletter

Get the latest Laravel/PHP jobs, events and curated articles straight to your inbox, once a week

Fathom Analytics | Fast, simple and privacy-focused website analytics. Fathom Analytics | Fast, simple and privacy-focused website analytics.
Achieve superior email deliverability with ToastMail! Our AI-driven tool warms up inboxes, monitors reputation, and ensures emails reach their intended destination. Sign up today for a spam-free future. Achieve superior email deliverability with ToastMail! Our AI-driven tool warms up inboxes, monitors reputation, and ensures emails reach their intended destination. Sign up today for a spam-free future.
Community Partners