PHP Class App\Services\Access\Access

Show file Open project: rappasoft/laravel-5-boilerplate Class Usage Examples

Public Methods

Method Description
allow ( string $permission ) : boolean Check if the current 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
guest ( ) : mixed Return if the current session user is a guest or not
hasPermission ( $permission ) : boolean
hasPermissions ( $permissions, $needsAll = false ) : boolean
hasRole ( string $role ) : boolean Checks if the current user has a Role by its name or id
hasRoles ( $roles, boolean $needsAll = false ) : boolean Checks if the user has either one or more, or all of an array of roles
id ( ) : mixed Get the currently authenticated user's id
loginUsingId ( $id ) : mixed
logout ( ) : mixed
user ( ) Get the currently authenticated user or null.

Method Details

allow() public method

Check if the current user has a permission by its name or id
public allow ( string $permission ) : boolean
$permission string Permission name or id.
return boolean

allowMultiple() public method

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

guest() public method

Return if the current session user is a guest or not
public guest ( ) : mixed
return mixed

hasPermission() public method

public hasPermission ( $permission ) : boolean
$permission
return boolean

hasPermissions() public method

public hasPermissions ( $permissions, $needsAll = false ) : boolean
$permissions
$needsAll
return boolean

hasRole() public method

Checks if the current user has a Role by its name or id
public hasRole ( string $role ) : boolean
$role string Role name.
return boolean

hasRoles() public method

Checks if the user has either one or more, or all of an array of roles
public hasRoles ( $roles, boolean $needsAll = false ) : boolean
$roles
$needsAll boolean
return boolean

id() public method

Get the currently authenticated user's id
public id ( ) : mixed
return mixed

loginUsingId() public method

public loginUsingId ( $id ) : mixed
$id
return mixed

logout() public method

public logout ( ) : mixed
return mixed

user() public method

Get the currently authenticated user or null.
public user ( )