PHP Trait Silber\Bouncer\Database\HasAbilities

Show file Open project: JosephSilber/bouncer

Public Methods

Method Description
abilities ( ) : Illuminate\Database\Eloquent\Relations\MorphToMany The abilities relationship.
allow ( mixed $ability, mixed | null $model = null ) Give an ability to the model.
disallow ( mixed $ability, mixed | null $model = null ) Remove an ability from the model.
forbid ( mixed $ability, mixed | null $model = null ) Forbid an ability to the model.
getAbilities ( ) : Illuminate\Database\Eloquent\Collection Get all of the model's allowed abilities.
getForbiddenAbilities ( ) : Illuminate\Database\Eloquent\Collection Get all of the model's allowed abilities.
unforbid ( mixed $ability, mixed | null $model = null ) Remove ability forbiddal from the model.

Protected Methods

Method Description
getClipboardInstance ( ) : Clipboard Get an instance of the bouncer's clipboard.

Method Details

abilities() public method

The abilities relationship.
public abilities ( ) : Illuminate\Database\Eloquent\Relations\MorphToMany
return Illuminate\Database\Eloquent\Relations\MorphToMany

allow() public method

Give an ability to the model.
public allow ( mixed $ability, mixed | null $model = null )
$ability mixed
$model mixed | null

disallow() public method

Remove an ability from the model.
public disallow ( mixed $ability, mixed | null $model = null )
$ability mixed
$model mixed | null

forbid() public method

Forbid an ability to the model.
public forbid ( mixed $ability, mixed | null $model = null )
$ability mixed
$model mixed | null

getAbilities() public method

Get all of the model's allowed abilities.
public getAbilities ( ) : Illuminate\Database\Eloquent\Collection
return Illuminate\Database\Eloquent\Collection

getClipboardInstance() protected method

Get an instance of the bouncer's clipboard.
protected getClipboardInstance ( ) : Clipboard
return Silber\Bouncer\Clipboard

getForbiddenAbilities() public method

Get all of the model's allowed abilities.
public getForbiddenAbilities ( ) : Illuminate\Database\Eloquent\Collection
return Illuminate\Database\Eloquent\Collection

unforbid() public method

Remove ability forbiddal from the model.
public unforbid ( mixed $ability, mixed | null $model = null )
$ability mixed
$model mixed | null