PHP Trait Silber\Bouncer\Database\IsAbility

显示文件 Open project: JosephSilber/bouncer

Public Methods

Method Description
createForModel ( Model | string $model, string | array $attributes ) : static Create a new ability for a specific model.
getIdentifierAttribute ( ) : string Get the identifier for this ability.
getSlugAttribute ( ) : string Get the ability's "slug" attribute.
makeForModel ( Model | string $model, string | array $attributes ) : static Make a new ability for a specific model.
roles ( ) : Illuminate\Database\Eloquent\Relations\MorphToMany The roles relationship.
scopeByName ( Builder | Builder $query, $name, $strict = false ) : void Constrain a query to having the given name.
scopeForModel ( Builder | Builder $query, Model | string $model, boolean $strict = false ) : void Constrain a query to an ability for a specific model.
scopeSimpleAbility ( Builder | Builder $query ) : void Constrain a query to simple abilities.
users ( ) : Illuminate\Database\Eloquent\Relations\MorphToMany The users relationship.

Method Details

createForModel() public static method

Create a new ability for a specific model.
public static createForModel ( Model | string $model, string | array $attributes ) : static
$model Illuminate\Database\Eloquent\Model | string
$attributes string | array
return static

getIdentifierAttribute() final public method

Get the identifier for this ability.
final public getIdentifierAttribute ( ) : string
return string

getSlugAttribute() public method

Get the ability's "slug" attribute.
public getSlugAttribute ( ) : string
return string

makeForModel() public static method

Make a new ability for a specific model.
public static makeForModel ( Model | string $model, string | array $attributes ) : static
$model Illuminate\Database\Eloquent\Model | string
$attributes string | array
return static

roles() public method

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

scopeByName() public method

Constrain a query to having the given name.
public scopeByName ( Builder | Builder $query, $name, $strict = false ) : void
$query Illuminate\Database\Eloquent\Builder | Illuminate\Database\Query\Builder
return void $name

scopeForModel() public method

Constrain a query to an ability for a specific model.
public scopeForModel ( Builder | Builder $query, Model | string $model, boolean $strict = false ) : void
$query Illuminate\Database\Eloquent\Builder | Illuminate\Database\Query\Builder
$model Illuminate\Database\Eloquent\Model | string
$strict boolean
return void

scopeSimpleAbility() public method

Constrain a query to simple abilities.
public scopeSimpleAbility ( Builder | Builder $query ) : void
$query Illuminate\Database\Eloquent\Builder | Illuminate\Database\Query\Builder
return void

users() public method

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