for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php namespace Anomaly\UsersModule\Role;
use Anomaly\Streams\Platform\Entry\EntryCollection;
use Anomaly\UsersModule\Role\Contract\RoleInterface;
/**
* Class RoleCollection
*
* @link http://anomaly.is/streams-platform
* @author AnomalyLabs, Inc. <[email protected]>
* @author Ryan Thompson <[email protected]>
* @package Anomaly\UsersModule\Role
*/
class RoleCollection extends EntryCollection
{
* Return all permissions.
* @return array
public function permissions()
return $this->map(
function (RoleInterface $role) {
return $role->getPermissions();
}
)->flatten()->all();
* Return if a role as access to a the permission.
* @param string $permission
* @return RoleCollection
public function hasPermission($permission)
return $this->filter(
function (RoleInterface $role) use ($permission) {
return $role->hasPermission($permission);
);