Skip to content

Commit

Permalink
fix code smells for codeclimate
Browse files Browse the repository at this point in the history
  • Loading branch information
mostafamaklad committed Mar 17, 2018
1 parent bc76fe8 commit 229b1bc
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Traits/HasRoles.php
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ public function hasRole($roles): bool
break;
}
}
} else {
} elseif($roles instanceof Collection) {
$hasRole = ! $roles->intersect($this->roles)->isEmpty();
}

Expand Down Expand Up @@ -208,7 +208,7 @@ public function hasAllRoles($roles): bool
$hasRoles = $this->roles->contains('name', $roles);
} elseif ($roles instanceof Role) {
$hasRoles = $this->roles->contains('id', $roles->id);
} else {
} elseif(\is_array($roles) || $roles instanceof Collection) {
$roles = \collect()->make($roles)->map(function ($role) {
return $role instanceof Role ? $role->name : $role;
});
Expand Down

0 comments on commit 229b1bc

Please sign in to comment.