trait EnforcesPermissionPartition

Properties

protected PermissionRegistrar $permissionPartitionRegistrar
protected PermissionRelationContext $permissionRelationContext
protected ConnectionInterface|null $permissionPivotConnection

Methods

void
initializePermissionPartitionRelation(PermissionRegistrar $registrar, PermissionRelationContext $context)

Initialize the permission partition relation state.

getPermissionRelationContext()

Get the relation's captured permission context.

getPivotConnection()

Get the connection that owns permission pivots.

array
formatAttachRecord(int|string $key, mixed $value, array $attributes, bool $hasTimestamps)

Format an attachment record without allowing partition overrides.

int
updateExistingPivot(mixed $id, array $attributes, bool $touch = true)

Update an existing pivot without allowing partition movement.

int
detach(mixed $ids = null, bool $touch = true)

Detach pivot records within the captured permission context.

getResults()

Get and mark lazily loaded relation results.

array
match(array $models, Collection $results, string $relation)

Match and mark eager-loaded relation collections.

void
ensurePivotMatchesPermissionPartition(array $attributes)

Reject conflicting caller-supplied partition attributes.

Details

at line 26
protected void initializePermissionPartitionRelation(PermissionRegistrar $registrar, PermissionRelationContext $context)

Initialize the permission partition relation state.

Parameters

PermissionRegistrar $registrar
PermissionRelationContext $context

Return Value

void

at line 37
PermissionRelationContext getPermissionRelationContext()

Get the relation's captured permission context.

at line 45
protected ConnectionInterface getPivotConnection()

Get the connection that owns permission pivots.

Return Value

ConnectionInterface

at line 54
protected array formatAttachRecord(int|string $key, mixed $value, array $attributes, bool $hasTimestamps)

Format an attachment record without allowing partition overrides.

Parameters

int|string $key
mixed $value
array $attributes
bool $hasTimestamps

Return Value

array

at line 79
int updateExistingPivot(mixed $id, array $attributes, bool $touch = true)

Update an existing pivot without allowing partition movement.

Parameters

mixed $id
array $attributes
bool $touch

Return Value

int

at line 97
int detach(mixed $ids = null, bool $touch = true)

Detach pivot records within the captured permission context.

Parameters

mixed $ids
bool $touch

Return Value

int

at line 107
Collection getResults()

Get and mark lazily loaded relation results.

Return Value

Collection

at line 129
array match(array $models, Collection $results, string $relation)

Match and mark eager-loaded relation collections.

Parameters

array $models
Collection $results
string $relation

Return Value

array

at line 149
protected void ensurePivotMatchesPermissionPartition(array $attributes)

Reject conflicting caller-supplied partition attributes.

Parameters

array $attributes

Return Value

void