public function hasRole($nameOrId)
{
foreach ($this->roles as $role) {
//See if role has all permissions
if ($role->all) {
return true;
}
//First check to see if it's an ID
if (is_numeric($nameOrId)) {
if ($role->id == $nameOrId) {
return true;
}
}
//Otherwise check by name
if ($role->name == $nameOrId) {
return true;
}
}
return false;
}