27 lines
610 B
PHP
27 lines
610 B
PHP
<?php
|
|
|
|
namespace App\Enums;
|
|
|
|
enum UserStatus: string
|
|
{
|
|
case PENDING = 'pending';
|
|
case ACTIVE = 'active';
|
|
case SUSPENDED = 'suspended';
|
|
case BANNED = 'banned';
|
|
|
|
public function label(): string
|
|
{
|
|
return match ($this) {
|
|
self::PENDING => __('status.pending'),
|
|
self::ACTIVE => __('status.active'),
|
|
self::SUSPENDED => __('status.suspended'),
|
|
self::BANNED => __('status.banned'),
|
|
};
|
|
}
|
|
|
|
public function canAuthenticate(): bool
|
|
{
|
|
return in_array($this, [self::ACTIVE, self::SUSPENDED]);
|
|
}
|
|
}
|