lacodix/laravel-global-or-scope
Add multiple Eloquent global scopes that are grouped and applied with OR logic instead of the default AND. Use a simple trait to register OR-scopes and optionally disable some or all of them per query with withoutGlobalOrScopes().
It is possible to disable/remove the global or scopes for single queries.
If you want to disable one of your or combined global scopes, you can just use the withoutGlobalOrScope method on the current query builder.
Post::query()->withoutGlobalOrScope(Scope1::class)->get();
you can also disable all global or scopes at once.
Post::query()->withoutGlobalOrScopes()->get();
if you need to know which scopes have been disabled you get it like so:
Post::query()->removedOrScopes();
If you want to disable all global scopes for the whole request, just call
Post::clearGlobalOrScopes();
How can I help you explore Laravel packages today?