PHP Trait Silber\Bouncer\Conductors\Traits\DisassociatesAbilities

Show file Open project: JosephSilber/bouncer

Public Methods

Method Description
to ( mixed $abilities, Model | string | null $entity = null, array $attributes = [] ) : boolean Remove the given ability from the model.

Protected Methods

Method Description
detachAbilitiesWithPivotConstraints ( Model $model, array $ids, array $constraints ) : void Detach the given IDs from the model, with the given pivot constraints.
filterNumericAbilities ( array $abilities ) : array Filter the provided abilities to the ones that are numeric.
getAbilityIds ( mixed $abilities, Model | string | null $model, array $attributes ) : array Get the IDs of the provided abilities.
getAbilityIdsFromModels ( array $abilities ) : array Get the Ability IDs from the models present in the given array.
getAbilityIdsFromStrings ( array $abilities ) : array Get the ability IDs from the names present in the given array.
getModel ( ) : Model | null Get the model from which to disassociate the abilities.
getModelAbilityId ( string $ability, Model | string $model, array $attributes ) : integer | null Get the ability ID for the given model.

Method Details

detachAbilitiesWithPivotConstraints() protected method

Detach the given IDs from the model, with the given pivot constraints.
protected detachAbilitiesWithPivotConstraints ( Model $model, array $ids, array $constraints ) : void
$model Illuminate\Database\Eloquent\Model
$ids array
$constraints array
return void

filterNumericAbilities() protected method

Filter the provided abilities to the ones that are numeric.
protected filterNumericAbilities ( array $abilities ) : array
$abilities array
return array

getAbilityIds() protected method

Get the IDs of the provided abilities.
protected getAbilityIds ( mixed $abilities, Model | string | null $model, array $attributes ) : array
$abilities mixed
$model Illuminate\Database\Eloquent\Model | string | null
$attributes array
return array

getAbilityIdsFromModels() protected method

Get the Ability IDs from the models present in the given array.
protected getAbilityIdsFromModels ( array $abilities ) : array
$abilities array
return array

getAbilityIdsFromStrings() protected method

Get the ability IDs from the names present in the given array.
protected getAbilityIdsFromStrings ( array $abilities ) : array
$abilities array
return array

getModel() protected method

Get the model from which to disassociate the abilities.
protected getModel ( ) : Model | null
return Illuminate\Database\Eloquent\Model | null

getModelAbilityId() protected method

Get the ability ID for the given model.
protected getModelAbilityId ( string $ability, Model | string $model, array $attributes ) : integer | null
$ability string
$model Illuminate\Database\Eloquent\Model | string
$attributes array
return integer | null

to() public method

Remove the given ability from the model.
public to ( mixed $abilities, Model | string | null $entity = null, array $attributes = [] ) : boolean
$abilities mixed
$entity Illuminate\Database\Eloquent\Model | string | null
$attributes array
return boolean