Eloquent & Datenzugriff v1

Disable Global Or Scopes

Laravel Global Or Scope · A Laravel package to add possibility to use global scopes with an or operation in Eloquent Models.

Version und Seiten
Commit dbbb1e2f51a6 Diese Seite auf GitHub

It is possible to disable/remove the global or scopes for single queries.

Disable one scope

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();

Disable all scopes

you can also disable all global or scopes at once.

Post::query()->withoutGlobalOrScopes()->get();

Get the disabled scopes

if you need to know which scopes have been disabled you get it like so:

Post::query()->removedOrScopes();

Disable all scopes for the whole request

If you want to disable all global scopes for the whole request, just call

Post::clearGlobalOrScopes();

Technisches Erstgespräch

Ein Paket als Baustein für Ihre Anwendung.

Wenn Architektur, Integration oder Betrieb entscheidend sind, besprechen wir Ihre Anwendung als Ganzes.

Projekt besprechen