Migrate backend to Porto architecture and fix minor bugs
- Fully transitioned the backend to the Porto architectural pattern - Improved code organization and maintainability - Fixed minor bugs and inconsistencies
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
namespace App\Ship\Enums\Education;
|
||||
|
||||
use Filament\Support\Contracts\HasLabel;
|
||||
use Filament\Support\Contracts\HasColor;
|
||||
|
||||
enum FormEducation: int implements HasLabel, HasColor
|
||||
{
|
||||
case FULL_TIME = 1; // Очная форма обучения
|
||||
|
||||
case FULL_PART_TIME = 2; // Заочная форма обучения
|
||||
|
||||
case PART_TIME = 3; // Заочная форма обучения
|
||||
|
||||
|
||||
|
||||
public static function fromName(string $name): ?self {
|
||||
return match ($name) {
|
||||
'FULL_TIME' => self::FULL_TIME,
|
||||
'FULL_PART_TIME' => self::FULL_PART_TIME,
|
||||
'PART_TIME' => self::PART_TIME,
|
||||
default => null,
|
||||
};
|
||||
}
|
||||
|
||||
public function getLabel(): ?string
|
||||
{
|
||||
return match ($this) {
|
||||
self::FULL_TIME => 'Очная форма обучения',
|
||||
self::FULL_PART_TIME => 'Очно-заочная форма обучения',
|
||||
self::PART_TIME => 'Заочная форма обучения',
|
||||
};
|
||||
}
|
||||
|
||||
public function getColor(): string|array|null
|
||||
{
|
||||
return match ($this) {
|
||||
self::FULL_TIME => 'success', // Цвет для очной формы
|
||||
self::PART_TIME => 'warning', // Цвет для заочной формы
|
||||
self::FULL_PART_TIME => 'info',
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user