public function hasPermission($permission)
    {
        if (!$permission) {
            return false;
        }
        foreach ($this->permissions as $perm) {
            if ($perm->name == $permission) {
                return true;
            }
        }
        return false;
    }
public function hasPermission($permission)
    {
        if (!$permission) {
            return false;
        }
        foreach ($this->permissions as $perm) {
            if ($perm->name == $permission) {
                return true;
            }
        }
        return false;
    }
public function hasPermission ( $ permission ) { if ( ! $ permission ) { return false ; } foreach ( $ this -> permissions as $ perm ) { if ( $ perm -> name == $ permission ) { return true ; } } return false ; }
Check if the role allows the permission being requested.

@param string $permission Name of Permission being checked
@return bool Does this role has the permission
Check if the role allows the permission being requested .