KTVCentral/app/Models/SongLibraryCache.php
allen.yan ef865b50e1 20250902
移除使用的密碼記錄
加入手機點歌介面
加入 ftp驗証
2025-09-02 11:25:28 +08:00

58 lines
1.5 KiB
PHP

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class SongLibraryCache extends Model
{
protected $table = 'song_library_cache';
protected $primaryKey = 'song_id';
public $incrementing = true;
protected $keyType = 'int';
const CREATED_AT = null;
const UPDATED_AT = 'updated_at';
// 可寫入的欄位(可依需要擴充)
protected $fillable = [
'song_name',
'song_simplified',
'phonetic_abbr',
'pinyin_abbr',
'strokes_abbr',
'song_number',
'artistA',
'artistB',
'artistA_simplified',
'artistB_simplified',
'artistA_category',
'artistB_category',
'artist_category',
'song_filename',
'song_category',
'language_name',
'add_date',
'situation',
'vocal',
'db_change',
'song_counts',
'updated_at',
];
public function users(){
return $this->belongsToMany(User::class, 'user_song')->withTimestamps();
}
public function str_artists_plus(): string
{
return ($this->artistB!=null) ? $this->artistA ." + ".$this->artistB :$this->artistA;
}
public function artists(){
return $this->belongsToMany(Artist::class);
}
public function str_categories(){
return $this->categories->pluck('name')->implode(', ');
}
public function categories(){
return $this->belongsToMany(SongCategory::class);
}
}