PHP Класс Silber\Bouncer\Bouncer

Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$clipboard Silber\Bouncer\Contracts\Clipboard The bouncer clipboard instance.
$gate Illuminate\Contracts\Auth\Access\Gate | null The access gate instance.

Открытые методы

Метод Описание
__construct ( Silber\Bouncer\Contracts\Clipboard $clipboard ) Constructor.
ability ( array $attributes = [] ) : Ability Get an instance of the ability model.
allow ( Model | string $authority ) : GivesAbility Start a chain, to allow the given authority an ability.
allows ( string $ability, array | mixed $arguments = [] ) : boolean Determine if the given ability should be granted for the current authority.
assign ( Role | string $role ) : AssignsRole Start a chain, to assign the given role to a model.
cache ( Illuminate\Contracts\Cache\Store $cache = null ) Use the given cache instance.
create ( Model $user = null ) : static Create a new Bouncer instance.
define ( string $ability, callable | string $callback ) Define a new ability using a callback.
denies ( string $ability, array | mixed $arguments = [] ) : boolean Determine if the given ability should be denied for the current authority.
disallow ( Model | string $authority ) : RemovesAbility Start a chain, to disallow the given authority an ability.
dontCache ( ) Fully disable all query caching.
forbid ( Model | string $authority ) : GivesAbility Start a chain, to forbid the given authority an ability.
getGate ( $throw = false ) : Illuminate\Contracts\Auth\Access\Gate | null Get the gate instance.
is ( Model $authority ) : ChecksRole Start a chain, to check if the given authority has a certain role.
make ( Model $user = null ) : Silber\Bouncer\Factory. Create a bouncer factory instance.
ownedVia ( string | Closure $model, string | Closure | null $attribute = null ) : void Register an attribute/callback to determine if a model is owned by a given authority.
refresh ( Model $authority = null ) Clear the cache.
refreshFor ( Model $authority ) Clear the cache for the given authority.
retract ( Role | string $role ) : RemovesRole Start a chain, to retract the given role from a model.
role ( array $attributes = [] ) : Role Get an instance of the role model.
seed ( ) Run the registered seeders.
seeder ( Closure | string $seeder ) Register a seeder callback.
setGate ( Illuminate\Contracts\Auth\Access\Gate $gate ) Set the access gate instance.
tables ( array $map ) : void Set custom table names.
unforbid ( Model | string $authority ) : RemovesAbility Start a chain, to unforbid the given authority an ability.
useAbilityModel ( string $model ) Set the model to be used for abilities.
useRoleModel ( string $model ) Set the model to be used for roles.
useUserModel ( string $model ) Set the model to be used for users.
usesCachedClipboard ( ) : boolean Determine whether the clipboard used is a cached clipboard.

Защищенные методы

Метод Описание
resolve ( string $abstract, array $parameters = [] ) : mixed Resolve the given type from the container.

Описание методов

__construct() публичный Метод

Constructor.
public __construct ( Silber\Bouncer\Contracts\Clipboard $clipboard )
$clipboard Silber\Bouncer\Contracts\Clipboard

ability() публичный Метод

Get an instance of the ability model.
public ability ( array $attributes = [] ) : Ability
$attributes array
Результат Silber\Bouncer\Database\Ability

allow() публичный Метод

Start a chain, to allow the given authority an ability.
public allow ( Model | string $authority ) : GivesAbility
$authority Illuminate\Database\Eloquent\Model | string
Результат Silber\Bouncer\Conductors\GivesAbility

allows() публичный Метод

Determine if the given ability should be granted for the current authority.
public allows ( string $ability, array | mixed $arguments = [] ) : boolean
$ability string
$arguments array | mixed
Результат boolean

assign() публичный Метод

Start a chain, to assign the given role to a model.
public assign ( Role | string $role ) : AssignsRole
$role Silber\Bouncer\Database\Role | string
Результат Silber\Bouncer\Conductors\AssignsRole

cache() публичный Метод

Use the given cache instance.
public cache ( Illuminate\Contracts\Cache\Store $cache = null )
$cache Illuminate\Contracts\Cache\Store

create() публичный статический Метод

Create a new Bouncer instance.
public static create ( Model $user = null ) : static
$user Illuminate\Database\Eloquent\Model
Результат static

define() публичный Метод

Define a new ability using a callback.
public define ( string $ability, callable | string $callback )
$ability string
$callback callable | string

denies() публичный Метод

Determine if the given ability should be denied for the current authority.
public denies ( string $ability, array | mixed $arguments = [] ) : boolean
$ability string
$arguments array | mixed
Результат boolean

disallow() публичный Метод

Start a chain, to disallow the given authority an ability.
public disallow ( Model | string $authority ) : RemovesAbility
$authority Illuminate\Database\Eloquent\Model | string
Результат Silber\Bouncer\Conductors\RemovesAbility

dontCache() публичный Метод

Fully disable all query caching.
public dontCache ( )

forbid() публичный Метод

Start a chain, to forbid the given authority an ability.
public forbid ( Model | string $authority ) : GivesAbility
$authority Illuminate\Database\Eloquent\Model | string
Результат Silber\Bouncer\Conductors\GivesAbility

getGate() публичный Метод

Get the gate instance.
public getGate ( $throw = false ) : Illuminate\Contracts\Auth\Access\Gate | null
Результат Illuminate\Contracts\Auth\Access\Gate | null

is() публичный Метод

Start a chain, to check if the given authority has a certain role.
public is ( Model $authority ) : ChecksRole
$authority Illuminate\Database\Eloquent\Model
Результат Silber\Bouncer\Conductors\ChecksRole

make() публичный статический Метод

Create a bouncer factory instance.
public static make ( Model $user = null ) : Silber\Bouncer\Factory.
$user Illuminate\Database\Eloquent\Model
Результат Silber\Bouncer\Factory.

ownedVia() публичный Метод

Register an attribute/callback to determine if a model is owned by a given authority.
public ownedVia ( string | Closure $model, string | Closure | null $attribute = null ) : void
$model string | Closure
$attribute string | Closure | null
Результат void

refresh() публичный Метод

Clear the cache.
public refresh ( Model $authority = null )
$authority Illuminate\Database\Eloquent\Model

refreshFor() публичный Метод

Clear the cache for the given authority.
public refreshFor ( Model $authority )
$authority Illuminate\Database\Eloquent\Model

resolve() защищенный Метод

Resolve the given type from the container.
protected resolve ( string $abstract, array $parameters = [] ) : mixed
$abstract string
$parameters array
Результат mixed

retract() публичный Метод

Start a chain, to retract the given role from a model.
public retract ( Role | string $role ) : RemovesRole
$role Silber\Bouncer\Database\Role | string
Результат Silber\Bouncer\Conductors\RemovesRole

role() публичный Метод

Get an instance of the role model.
public role ( array $attributes = [] ) : Role
$attributes array
Результат Silber\Bouncer\Database\Role

seed() публичный Метод

Run the registered seeders.
public seed ( )

seeder() публичный Метод

Register a seeder callback.
public seeder ( Closure | string $seeder )
$seeder Closure | string

setGate() публичный Метод

Set the access gate instance.
public setGate ( Illuminate\Contracts\Auth\Access\Gate $gate )
$gate Illuminate\Contracts\Auth\Access\Gate

tables() публичный статический Метод

Set custom table names.
public static tables ( array $map ) : void
$map array
Результат void

unforbid() публичный Метод

Start a chain, to unforbid the given authority an ability.
public unforbid ( Model | string $authority ) : RemovesAbility
$authority Illuminate\Database\Eloquent\Model | string
Результат Silber\Bouncer\Conductors\RemovesAbility

useAbilityModel() публичный статический Метод

Set the model to be used for abilities.
public static useAbilityModel ( string $model )
$model string

useRoleModel() публичный статический Метод

Set the model to be used for roles.
public static useRoleModel ( string $model )
$model string

useUserModel() публичный статический Метод

Set the model to be used for users.
public static useUserModel ( string $model )
$model string

usesCachedClipboard() публичный Метод

Determine whether the clipboard used is a cached clipboard.
public usesCachedClipboard ( ) : boolean
Результат boolean

Описание свойств

$clipboard защищенное свойство

The bouncer clipboard instance.
protected Clipboard,Silber\Bouncer\Contracts $clipboard
Результат Silber\Bouncer\Contracts\Clipboard

$gate защищенное свойство

The access gate instance.
protected Gate,Illuminate\Contracts\Auth\Access|null $gate
Результат Illuminate\Contracts\Auth\Access\Gate | null