*/ protected $fillable = [ 'name', 'manufacturer_id', 'description', 'category', ]; /** * The attributes that should be cast. * * @var array */ 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; } }