Files
sam-manage/app/Models/Rd/CmSong.php
김보곤 b831979153 feat: [database] codebridge DB 분리 재적용 - 55개 MNG 전용 모델만 설정
- API 사용 테이블 22개(23개 모델) 제외하고 55개 모델만 $connection = 'codebridge' 적용
- config/database.php에 codebridge connection 재추가
- 제외 대상: Barobill 12개, ESign 4개, Audit 2개, DevTools 1개, System 2개, HR 1개
2026-03-09 20:02:04 +09:00

59 lines
1.2 KiB
PHP

<?php
namespace App\Models\Rd;
use App\Models\User;
use App\Traits\BelongsToTenant;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\SoftDeletes;
class CmSong extends Model
{
use BelongsToTenant, SoftDeletes;
protected $connection = 'codebridge';
protected $table = 'cm_songs';
protected $fillable = [
'tenant_id',
'user_id',
'company_name',
'industry',
'lyrics',
'audio_path',
'options',
];
protected $casts = [
'options' => 'array',
];
public function user(): BelongsTo
{
return $this->belongsTo(User::class);
}
public function getOption(string $key, mixed $default = null): mixed
{
return data_get($this->options, $key, $default);
}
public function setOption(string $key, mixed $value): void
{
$options = $this->options ?? [];
data_set($options, $key, $value);
$this->options = $options;
}
public function getMood(): string
{
return $this->getOption('mood', '-');
}
public function getDuration(): int
{
return $this->getOption('duration', 15);
}
}