HasGlobalScopes
trait HasGlobalScopes
Methods
Boot the has global scopes trait for a model.
Resolve the global scope class names from the attributes.
Register a new global scope on the model.
Register multiple global scopes on the model.
Get all of the global scopes that are currently registered.
Set the current global scopes.
Get the global scopes for this class instance.
Details
at line 23
static void
bootHasGlobalScopes()
Boot the has global scopes trait for a model.
at line 31
static array
resolveGlobalScopeAttributes()
Resolve the global scope class names from the attributes.
at line 68
static mixed
addGlobalScope(Scope|Closure|string $scope, Scope|Closure|null $implementation = null)
Register a new global scope on the model.
Boot-only. The scope persists in a static property for the worker lifetime and applies to every query for this model class across all coroutines.
at line 92
static void
addGlobalScopes(array $scopes)
Register multiple global scopes on the model.
Boot-only. Delegates to addGlobalScope() per entry; each scope persists in a static property for the worker lifetime.
at line 106
static bool
hasGlobalScope(Scope|int|string $scope)
Determine if a model has a global scope.
at line 116
static Scope|Closure|null
getGlobalScope(Scope|int|string $scope)
Get a global scope registered with the model.
at line 128
static array
getAllGlobalScopes()
Get all of the global scopes that are currently registered.
at line 140
static void
setAllGlobalScopes(array $scopes)
Set the current global scopes.
Boot or tests only. Replaces the worker-wide global scopes registry shared by every coroutine; per-request use changes scope behavior for every concurrent model query.
at line 148
array
getGlobalScopes()
Get the global scopes for this class instance.