pp-planer/app/Models/SongArrangement.php

42 lines
848 B
PHP

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\HasMany;
class SongArrangement extends Model
{
use HasFactory;
protected $fillable = [
'song_id',
'name',
'is_default',
];
protected function casts(): array
{
return [
'is_default' => 'boolean',
];
}
public function song(): BelongsTo
{
return $this->belongsTo(Song::class);
}
public function arrangementLabels(): HasMany
{
return $this->hasMany(SongArrangementLabel::class)->orderBy('order');
}
public function serviceSongs(): HasMany
{
return $this->hasMany(ServiceSong::class);
}
}