class PermittedScope implements Scope (View source)

Scope to restrict model visibility according to the permission system.

Without any parameters, this scope will restrict query results to only those models with IDs that the user (or their groups) has been granted permission in the permissions table.

The model to get IDs for, as well as the key in the current query that corresponds to those IDs, can be customized so that for example, posts can be filtered by their channel_id.

Methods

__construct(string|null $model = null, string $key = 'id', string $ability = 'view', User|null $user = null)

No description

apply(Builder $builder, Model $model)

No description

Details

__construct(string|null $model = null, string $key = 'id', string $ability = 'view', User|null $user = null)

No description

Parameters

string|null $model
string $key
string $ability
User|null $user

apply(Builder $builder, Model $model)

No description

Parameters

Builder $builder
Model $model