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:
pacnpal
2025-02-25 20:37:19 -05:00
parent 8951e59f49
commit 64b0e90a27
35 changed files with 3157 additions and 1 deletions

58
app/Models/RideModel.php Normal file
View File

@@ -0,0 +1,58 @@
<?php
namespace App\Models;
use App\Enums\RideCategory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\HasMany;
class RideModel extends Model
{
/**
* The attributes that are mass assignable.
*
* @var array<string>
*/
protected $fillable = [
'name',
'manufacturer_id',
'description',
'category',
];
/**
* The attributes that should be cast.
*
* @var array<string, string>
*/
protected $casts = [
'category' => RideCategory::class,
];
/**
* Get the manufacturer that produces this ride model.
*/
public function manufacturer(): BelongsTo
{
return $this->belongsTo(Manufacturer::class);
}
/**
* Get the rides that are instances of this model.
*/
public function rides(): HasMany
{
return $this->hasMany(Ride::class);
}
/**
* Get the full name of the ride model including manufacturer.
*/
public function getFullNameAttribute(): string
{
return $this->manufacturer
? "{$this->manufacturer->name} {$this->name}"
: $this->name;
}
}