PHP Class Silber\Bouncer\Conductors\AssignsRole

Mostrar archivo Open project: JosephSilber/bouncer

Protected Properties

Property Type Description
$role Silber\Bouncer\Database\Role | string The role to be assigned to an authority.

Public Methods

Method Description
__construct ( Role | string $role ) Constructor.
to ( Model | array | integer $authority ) : boolean Assign the role to the given authority.

Protected Methods

Method Description
assignRole ( Role $role, string $class, array $keys ) : void Assign the role to the authorities with the given keys.
getAuthoritiesWithRole ( Role $role, string $class, array $ids ) : Collection Get the keys of the authorities that already have the given role.
role ( ) : Role Get or create the role.

Method Details

__construct() public method

Constructor.
public __construct ( Role | string $role )
$role Silber\Bouncer\Database\Role | string

assignRole() protected method

Assign the role to the authorities with the given keys.
protected assignRole ( Role $role, string $class, array $keys ) : void
$role Silber\Bouncer\Database\Role
$class string
$keys array
return void

getAuthoritiesWithRole() protected method

Get the keys of the authorities that already have the given role.
protected getAuthoritiesWithRole ( Role $role, string $class, array $ids ) : Collection
$role Silber\Bouncer\Database\Role
$class string
$ids array
return Illuminate\Support\Collection

role() protected method

Get or create the role.
protected role ( ) : Role
return Silber\Bouncer\Database\Role

to() public method

Assign the role to the given authority.
public to ( Model | array | integer $authority ) : boolean
$authority Illuminate\Database\Eloquent\Model | array | integer
return boolean

Property Details

$role protected_oe property

The role to be assigned to an authority.
protected Role,Silber\Bouncer\Database|string $role
return Silber\Bouncer\Database\Role | string