PHP Trait app\Models\Access\User\Traits\UserAccess

Afficher le fichier Open project: rappasoft/laravel-5-boilerplate

Méthodes publiques

Méthode Description
allow ( string $nameOrId ) : boolean Check if user has a permission by its name or id.
allowMultiple ( $permissions, $needsAll = false ) : boolean Check an array of permissions and whether or not all are required to continue
attachRole ( mixed $role ) : void Alias to eloquent many-to-many relation's attach() method.
attachRoles ( mixed $roles ) : void Attach multiple roles to a user
detachRole ( mixed $role ) : void Alias to eloquent many-to-many relation's detach() method.
detachRoles ( mixed $roles ) : void Detach multiple roles from a user
hasPermission ( $nameOrId ) : boolean
hasPermissions ( $permissions, boolean $needsAll = false ) : boolean
hasRole ( string $nameOrId ) : boolean Checks if the user has a Role by its name or id.
hasRoles ( $roles, $needsAll = false ) : boolean Checks to see if user has array of roles

Method Details

allow() public méthode

Check if user has a permission by its name or id.
public allow ( string $nameOrId ) : boolean
$nameOrId string Permission name or id.
Résultat boolean

allowMultiple() public méthode

Check an array of permissions and whether or not all are required to continue
public allowMultiple ( $permissions, $needsAll = false ) : boolean
$permissions
$needsAll
Résultat boolean

attachRole() public méthode

Alias to eloquent many-to-many relation's attach() method.
public attachRole ( mixed $role ) : void
$role mixed
Résultat void

attachRoles() public méthode

Attach multiple roles to a user
public attachRoles ( mixed $roles ) : void
$roles mixed
Résultat void

detachRole() public méthode

Alias to eloquent many-to-many relation's detach() method.
public detachRole ( mixed $role ) : void
$role mixed
Résultat void

detachRoles() public méthode

Detach multiple roles from a user
public detachRoles ( mixed $roles ) : void
$roles mixed
Résultat void

hasPermission() public méthode

public hasPermission ( $nameOrId ) : boolean
$nameOrId
Résultat boolean

hasPermissions() public méthode

public hasPermissions ( $permissions, boolean $needsAll = false ) : boolean
$permissions
$needsAll boolean
Résultat boolean

hasRole() public méthode

Checks if the user has a Role by its name or id.
public hasRole ( string $nameOrId ) : boolean
$nameOrId string Role name or id.
Résultat boolean

hasRoles() public méthode

All must return true
public hasRoles ( $roles, $needsAll = false ) : boolean
$roles
$needsAll
Résultat boolean