BuildsPermissionRelations
trait BuildsPermissionRelations
Build Permission relations from one immutable partition and team snapshot.
The captured context must constrain related and pivot queries for the relation's lifetime, even if ambient context later changes.
Methods
Build a partition-aware belongs-to-many relation.
Build a partition-aware morph-to-many relation.
Build the related query using the relation's captured partition.
Ensure a partition-bearing relation parent belongs to the captured partition.
Apply the captured partition to pivot reads and writes.
Details
at line 35
protected BelongsToMany
permissionBelongsToMany(string $related, string $table, string $foreignPivotKey, string $relatedPivotKey, string $relationName, PermissionRelationContext|null $context = null)
Build a partition-aware belongs-to-many relation.
at line 72
protected MorphToMany
permissionMorphToMany(string $related, string $table, string $foreignPivotKey, string $relatedPivotKey, string $relationName, bool $inverse = false, bool $teamScoped = false, PermissionRelationContext|null $context = null)
Build a partition-aware morph-to-many relation.
at line 129
protected Builder
permissionRelationQuery(Model $related, PermissionPartition|null $partition)
Build the related query using the relation's captured partition.
at line 144
protected void
ensurePermissionRelationParentMatches(PermissionRegistrar $registrar, PermissionPartition|null $partition)
Ensure a partition-bearing relation parent belongs to the captured partition.
at line 178
protected BelongsToMany
applyPermissionPartitionToRelation(BelongsToMany $relation, PermissionPartition|null $partition)
Apply the captured partition to pivot reads and writes.