mirror of
https://github.com/pacnpal/thrillwiki_laravel.git
synced 2025-12-20 12:11:14 -05:00
3.2 KiB
3.2 KiB
Ride System Enums Documentation
Overview
The Rides system uses several enum classes to maintain consistent data and provide type safety for various ride attributes. All enums follow a consistent pattern with common helper methods for values, labels, and options.
Implementation Details
1. RideCategory
- Purpose: Categorizes different types of rides
- Location:
app/Enums/RideCategory.php - Values:
SELECT(''): Default selection promptROLLER_COASTER('RC'): Roller coastersDARK_RIDE('DR'): Dark ridesFLAT_RIDE('FR'): Flat ridesWATER_RIDE('WR'): Water ridesTRANSPORT('TR'): Transport ridesOTHER('OT'): Other ride types
2. RideStatus
- Purpose: Tracks operational status of rides
- Location:
app/Enums/RideStatus.php - Values:
SELECT(''): Default selection promptOPERATING: Currently operatingCLOSED_TEMP: Temporarily closedSBNO: Standing but not operatingCLOSING: Scheduled for closureCLOSED_PERM: Permanently closedUNDER_CONSTRUCTION: Under constructionDEMOLISHED: DemolishedRELOCATED: Relocated
- Features:
- Includes post-closing status handling
- Helper methods for filtering post-closing statuses
3. TrackMaterial
- Purpose: Specifies roller coaster track material
- Location:
app/Enums/TrackMaterial.php - Values:
STEEL: Steel tracksWOOD: Wooden tracksHYBRID: Hybrid construction
4. RollerCoasterType
- Purpose: Defines specific roller coaster configurations
- Location:
app/Enums/RollerCoasterType.php - Values:
SITDOWN: Traditional sit-down coasterINVERTED: Inverted coasterFLYING: Flying coasterSTANDUP: Stand-up coasterWING: Wing coasterDIVE: Dive coasterFAMILY: Family coasterWILD_MOUSE: Wild Mouse styleSPINNING: Spinning coasterFOURTH_DIMENSION: 4th Dimension coasterOTHER: Other configurations
5. LaunchType
- Purpose: Specifies ride launch mechanism
- Location:
app/Enums/LaunchType.php - Values:
CHAIN: Traditional chain liftLSM: Linear Synchronous Motor launchHYDRAULIC: Hydraulic launch systemGRAVITY: Gravity-powered launchOTHER: Other launch types
Common Features
All enum classes include:
- String-backed values for database storage
- Human-readable labels via
label()method - Helper methods:
values(): Get all enum valueslabels(): Get all human-readable labelsoptions(): Get value-label pairs for forms
Usage Notes
- All enums maintain exact parity with Django choices
- Used in models for type validation
- Support form select options generation
- Enable consistent validation rules
- Provide clean database values
Design Decisions
- Used PHP 8.1 enum feature for type safety
- Maintained consistent method names across all enums
- Added helper methods to simplify form handling
- Included blank/select options where needed
- Used string backing for database compatibility
Related Files
app/Models/Ride.php(uses RideCategory, RideStatus)app/Models/RollerCoasterStats.php(uses TrackMaterial, RollerCoasterType, LaunchType)- Future Livewire components for ride forms