mirror of
https://github.com/pacnpal/thrillwiki_laravel.git
synced 2025-12-20 11: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:
38
app/Enums/LaunchType.php
Normal file
38
app/Enums/LaunchType.php
Normal file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
namespace App\Enums;
|
||||
|
||||
enum LaunchType: string
|
||||
{
|
||||
case CHAIN = 'CHAIN';
|
||||
case LSM = 'LSM';
|
||||
case HYDRAULIC = 'HYDRAULIC';
|
||||
case GRAVITY = 'GRAVITY';
|
||||
case OTHER = 'OTHER';
|
||||
|
||||
public function label(): string
|
||||
{
|
||||
return match($this) {
|
||||
self::CHAIN => 'Chain Lift',
|
||||
self::LSM => 'LSM Launch',
|
||||
self::HYDRAULIC => 'Hydraulic Launch',
|
||||
self::GRAVITY => 'Gravity',
|
||||
self::OTHER => 'Other',
|
||||
};
|
||||
}
|
||||
|
||||
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());
|
||||
}
|
||||
}
|
||||
28
app/Enums/ReviewStatus.php
Normal file
28
app/Enums/ReviewStatus.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace App\Enums;
|
||||
|
||||
enum ReviewStatus: string
|
||||
{
|
||||
case PENDING = 'pending';
|
||||
case APPROVED = 'approved';
|
||||
case REJECTED = 'rejected';
|
||||
|
||||
public function label(): string
|
||||
{
|
||||
return match($this) {
|
||||
self::PENDING => 'Pending',
|
||||
self::APPROVED => 'Approved',
|
||||
self::REJECTED => 'Rejected',
|
||||
};
|
||||
}
|
||||
|
||||
public function color(): string
|
||||
{
|
||||
return match($this) {
|
||||
self::PENDING => 'yellow',
|
||||
self::APPROVED => 'green',
|
||||
self::REJECTED => 'red',
|
||||
};
|
||||
}
|
||||
}
|
||||
42
app/Enums/RideCategory.php
Normal file
42
app/Enums/RideCategory.php
Normal file
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace App\Enums;
|
||||
|
||||
enum RideCategory: string
|
||||
{
|
||||
case SELECT = '';
|
||||
case ROLLER_COASTER = 'RC';
|
||||
case DARK_RIDE = 'DR';
|
||||
case FLAT_RIDE = 'FR';
|
||||
case WATER_RIDE = 'WR';
|
||||
case TRANSPORT = 'TR';
|
||||
case OTHER = 'OT';
|
||||
|
||||
public function label(): string
|
||||
{
|
||||
return match($this) {
|
||||
self::SELECT => 'Select ride type',
|
||||
self::ROLLER_COASTER => 'Roller Coaster',
|
||||
self::DARK_RIDE => 'Dark Ride',
|
||||
self::FLAT_RIDE => 'Flat Ride',
|
||||
self::WATER_RIDE => 'Water Ride',
|
||||
self::TRANSPORT => 'Transport',
|
||||
self::OTHER => 'Other',
|
||||
};
|
||||
}
|
||||
|
||||
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());
|
||||
}
|
||||
}
|
||||
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)
|
||||
);
|
||||
}
|
||||
}
|
||||
50
app/Enums/RollerCoasterType.php
Normal file
50
app/Enums/RollerCoasterType.php
Normal file
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
namespace App\Enums;
|
||||
|
||||
enum RollerCoasterType: string
|
||||
{
|
||||
case SITDOWN = 'SITDOWN';
|
||||
case INVERTED = 'INVERTED';
|
||||
case FLYING = 'FLYING';
|
||||
case STANDUP = 'STANDUP';
|
||||
case WING = 'WING';
|
||||
case DIVE = 'DIVE';
|
||||
case FAMILY = 'FAMILY';
|
||||
case WILD_MOUSE = 'WILD_MOUSE';
|
||||
case SPINNING = 'SPINNING';
|
||||
case FOURTH_DIMENSION = 'FOURTH_DIMENSION';
|
||||
case OTHER = 'OTHER';
|
||||
|
||||
public function label(): string
|
||||
{
|
||||
return match($this) {
|
||||
self::SITDOWN => 'Sit Down',
|
||||
self::INVERTED => 'Inverted',
|
||||
self::FLYING => 'Flying',
|
||||
self::STANDUP => 'Stand Up',
|
||||
self::WING => 'Wing',
|
||||
self::DIVE => 'Dive',
|
||||
self::FAMILY => 'Family',
|
||||
self::WILD_MOUSE => 'Wild Mouse',
|
||||
self::SPINNING => 'Spinning',
|
||||
self::FOURTH_DIMENSION => '4th Dimension',
|
||||
self::OTHER => 'Other',
|
||||
};
|
||||
}
|
||||
|
||||
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());
|
||||
}
|
||||
}
|
||||
34
app/Enums/TrackMaterial.php
Normal file
34
app/Enums/TrackMaterial.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace App\Enums;
|
||||
|
||||
enum TrackMaterial: string
|
||||
{
|
||||
case STEEL = 'STEEL';
|
||||
case WOOD = 'WOOD';
|
||||
case HYBRID = 'HYBRID';
|
||||
|
||||
public function label(): string
|
||||
{
|
||||
return match($this) {
|
||||
self::STEEL => 'Steel',
|
||||
self::WOOD => 'Wood',
|
||||
self::HYBRID => 'Hybrid',
|
||||
};
|
||||
}
|
||||
|
||||
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());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user