- Add cts_song_id column to songs and service_songs for CCLI-free matching fallback - Filter information slides by uploaded_at <= service date (not shown before upload) - New arrangements use song's default group ordering instead of cloning - Auto-set use_translation=true when matched song has translation - Update syncSongs/syncServiceAgendaSongs to store and use cts_song_id - Add tests for CTS song ID fallback, upload date filtering, and translation defaults
50 lines
1 KiB
PHP
50 lines
1 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
|
|
class ServiceSong extends Model
|
|
{
|
|
use HasFactory;
|
|
|
|
protected $fillable = [
|
|
'service_id',
|
|
'song_id',
|
|
'song_arrangement_id',
|
|
'use_translation',
|
|
'order',
|
|
'cts_song_name',
|
|
'cts_ccli_id',
|
|
'cts_song_id',
|
|
'matched_at',
|
|
'request_sent_at',
|
|
];
|
|
|
|
protected function casts(): array
|
|
{
|
|
return [
|
|
'use_translation' => 'boolean',
|
|
'matched_at' => 'datetime',
|
|
'request_sent_at' => 'datetime',
|
|
];
|
|
}
|
|
|
|
public function service(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Service::class);
|
|
}
|
|
|
|
public function song(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Song::class);
|
|
}
|
|
|
|
public function arrangement(): BelongsTo
|
|
{
|
|
return $this->belongsTo(SongArrangement::class, 'song_arrangement_id');
|
|
}
|
|
}
|