trait HasGlobalScopes (View source)

Methods

static void
bootHasGlobalScopes()

Boot the has global scopes trait for a model.

static array
resolveGlobalScopeAttributes()

Resolve the global scope class names from the attributes.

static mixed
addGlobalScope(Scope|Closure|string $scope, Scope|Closure|null $implementation = null)

Register a new global scope on the model.

static void
addGlobalScopes(array $scopes)

Register multiple global scopes on the model.

static bool
hasGlobalScope(Scope|string $scope)

Determine if a model has a global scope.

static Scope|Closure|null
getGlobalScope(Scope|string $scope)

Get a global scope registered with the model.

static array
getAllGlobalScopes()

Get all of the global scopes that are currently registered.

static void
setAllGlobalScopes(array $scopes)

Set the current global scopes.

array
getGlobalScopes()

Get the global scopes for this class instance.

Details

static void bootHasGlobalScopes()

Boot the has global scopes trait for a model.

Return Value

void

static array resolveGlobalScopeAttributes()

Resolve the global scope class names from the attributes.

Return Value

array

static mixed addGlobalScope(Scope|Closure|string $scope, Scope|Closure|null $implementation = null)

Register a new global scope on the model.

Parameters

Scope|Closure|string $scope
Scope|Closure|null $implementation

Return Value

mixed

Exceptions

InvalidArgumentException

static void addGlobalScopes(array $scopes)

Register multiple global scopes on the model.

Parameters

array $scopes

Return Value

void

static bool hasGlobalScope(Scope|string $scope)

Determine if a model has a global scope.

Parameters

Scope|string $scope

Return Value

bool

static Scope|Closure|null getGlobalScope(Scope|string $scope)

Get a global scope registered with the model.

Parameters

Scope|string $scope

Return Value

Scope|Closure|null

static array getAllGlobalScopes()

Get all of the global scopes that are currently registered.

Return Value

array

static void setAllGlobalScopes(array $scopes)

Set the current global scopes.

Parameters

array $scopes

Return Value

void

array getGlobalScopes()

Get the global scopes for this class instance.

Return Value

array