Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions src/Entrust/Entrust.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,23 @@ public function can($permission, $requireAll = false)
return false;
}

/**
* Check if the current user has a role or permission by its name
*
* @param array|string $roles The role(s) needed.
* @param array|string $permissions The permission(s) needed.
* @param array $options The Options.
*
* @return bool
*/
public function ability($roles, $permissions, $options = [])
{
if ($user = $this->user()) {
return $user->ability($roles, $permissions, $options);
}
return false;
}

/**
* Get the currently authenticated user or null.
*
Expand Down