mirror of
https://github.com/pacnpal/thrillwiki_laravel.git
synced 2025-12-20 08:51:11 -05:00
Add enums for ReviewStatus, TrackMaterial, LaunchType, RideCategory, and RollerCoasterType; implement Designer and RideModel models; create migrations for ride_models and helpful_votes tables; enhance RideGalleryComponent documentation
This commit is contained in:
71
app/Enums/RideStatus.php
Normal file
71
app/Enums/RideStatus.php
Normal file
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
|
||||
namespace App\Enums;
|
||||
|
||||
enum RideStatus: string
|
||||
{
|
||||
case SELECT = '';
|
||||
case OPERATING = 'OPERATING';
|
||||
case CLOSED_TEMP = 'CLOSED_TEMP';
|
||||
case SBNO = 'SBNO';
|
||||
case CLOSING = 'CLOSING';
|
||||
case CLOSED_PERM = 'CLOSED_PERM';
|
||||
case UNDER_CONSTRUCTION = 'UNDER_CONSTRUCTION';
|
||||
case DEMOLISHED = 'DEMOLISHED';
|
||||
case RELOCATED = 'RELOCATED';
|
||||
|
||||
public function label(): string
|
||||
{
|
||||
return match($this) {
|
||||
self::SELECT => 'Select status',
|
||||
self::OPERATING => 'Operating',
|
||||
self::CLOSED_TEMP => 'Temporarily Closed',
|
||||
self::SBNO => 'Standing But Not Operating',
|
||||
self::CLOSING => 'Closing',
|
||||
self::CLOSED_PERM => 'Permanently Closed',
|
||||
self::UNDER_CONSTRUCTION => 'Under Construction',
|
||||
self::DEMOLISHED => 'Demolished',
|
||||
self::RELOCATED => 'Relocated',
|
||||
};
|
||||
}
|
||||
|
||||
public function isPostClosingStatus(): bool
|
||||
{
|
||||
return in_array($this, [
|
||||
self::SBNO,
|
||||
self::CLOSED_PERM,
|
||||
]);
|
||||
}
|
||||
|
||||
public static function postClosingStatuses(): array
|
||||
{
|
||||
return [
|
||||
self::SBNO,
|
||||
self::CLOSED_PERM,
|
||||
];
|
||||
}
|
||||
|
||||
public static function values(): array
|
||||
{
|
||||
return array_column(self::cases(), 'value');
|
||||
}
|
||||
|
||||
public static function labels(): array
|
||||
{
|
||||
return array_map(fn($case) => $case->label(), self::cases());
|
||||
}
|
||||
|
||||
public static function options(): array
|
||||
{
|
||||
return array_combine(self::values(), self::labels());
|
||||
}
|
||||
|
||||
public static function postClosingOptions(): array
|
||||
{
|
||||
$statuses = array_filter(self::cases(), fn($case) => $case->isPostClosingStatus());
|
||||
return array_combine(
|
||||
array_column($statuses, 'value'),
|
||||
array_map(fn($case) => $case->label(), $statuses)
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user