PHP Trait Silber\Bouncer\Database\IsRole

Inheritance: use trait HasAbilities, use trait Authorizable
Show file Open project: JosephSilber/bouncer

Public Methods

Method Description
assignTo ( string | Model | Illuminate\Database\Eloquent\Collection $model, array $keys = null ) Assign the role to the given model(s).
getClipboardInstance ( )
retractFrom ( string | Model | Illuminate\Database\Eloquent\Collection $model, array $keys = null ) Retract the role from the given model(s).
scopeWhereAssignedTo ( Builder $query, string | Model | Illuminate\Database\Eloquent\Collection $model, array $keys = null ) : void Constrain the given query to roles that were assigned to the given authorities.
users ( ) : Illuminate\Database\Eloquent\Relations\MorphedByMany The users relationship.

Protected Methods

Method Description
createAssignRecords ( Model $model, array $keys ) : array Create the pivot table records for assigning the role to given models.

Method Details

assignTo() public method

Assign the role to the given model(s).
public assignTo ( string | Model | Illuminate\Database\Eloquent\Collection $model, array $keys = null )
$model string | Illuminate\Database\Eloquent\Model | Illuminate\Database\Eloquent\Collection
$keys array

createAssignRecords() protected method

Create the pivot table records for assigning the role to given models.
protected createAssignRecords ( Model $model, array $keys ) : array
$model Illuminate\Database\Eloquent\Model
$keys array
return array

getClipboardInstance() public method

retractFrom() public method

Retract the role from the given model(s).
public retractFrom ( string | Model | Illuminate\Database\Eloquent\Collection $model, array $keys = null )
$model string | Illuminate\Database\Eloquent\Model | Illuminate\Database\Eloquent\Collection
$keys array

scopeWhereAssignedTo() public method

Constrain the given query to roles that were assigned to the given authorities.
public scopeWhereAssignedTo ( Builder $query, string | Model | Illuminate\Database\Eloquent\Collection $model, array $keys = null ) : void
$query Illuminate\Database\Eloquent\Builder
$model string | Illuminate\Database\Eloquent\Model | Illuminate\Database\Eloquent\Collection
$keys array
return void

users() public method

The users relationship.
public users ( ) : Illuminate\Database\Eloquent\Relations\MorphedByMany
return Illuminate\Database\Eloquent\Relations\MorphedByMany