* #20 - wip * #20 - wip * #20 - fix * #20 - wip * #20 - fix * #20 - fix
This commit is contained in:
30
app/Domain/Enums/Role.php
Normal file
30
app/Domain/Enums/Role.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Toby\Domain\Enums;
|
||||
|
||||
enum Role: string
|
||||
{
|
||||
case EMPLOYEE = "employee";
|
||||
case ADMINISTRATOR = "administrator";
|
||||
case TECHNICAL_APPROVER = "technical_approver";
|
||||
case ADMINISTRATIVE_APPROVER = "administrative_approver";
|
||||
|
||||
public function label(): string
|
||||
{
|
||||
return __($this->value);
|
||||
}
|
||||
|
||||
public static function casesToSelect(): array
|
||||
{
|
||||
$cases = collect(Role::cases());
|
||||
|
||||
return $cases->map(
|
||||
fn(Role $enum) => [
|
||||
"label" => $enum->label(),
|
||||
"value" => $enum->value,
|
||||
],
|
||||
)->toArray();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user