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 22
static void
bootHasGlobalScopes()
Boot the has global scopes trait for a model.
at line 30
static array
resolveGlobalScopeAttributes()
Resolve the global scope class names from the attributes.
at line 67
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 91
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 105
static bool
hasGlobalScope(Scope|string $scope)
Determine if a model has a global scope.
at line 115
static Scope|Closure|null
getGlobalScope(Scope|string $scope)
Get a global scope registered with the model.
at line 130
static array
getAllGlobalScopes()
Get all of the global scopes that are currently registered.
at line 142
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 150
array
getGlobalScopes()
Get the global scopes for this class instance.