Created
July 14, 2022 15:48
-
-
Save richardDobron/aa4207654f63540614a9e0c9ab31e4fb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use App\Enums\UserRoleTypes; | |
class User | |
{ | |
// ... | |
public function hasRole(int $roleId): bool | |
{ | |
return $this->roleId === $roleId; | |
} | |
public function isAnalyst(): bool | |
{ | |
return $this->roleId === UserRoleTypes::INSIGHTS_ANALYST; | |
} | |
} | |
// ... | |
$user->hasRole(UserRoleTypes::MANAGER); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment