Files
sam-manage/app/Models/Rd/CmSong.php
김보곤 ca50f65124 feat: [database] codebridge DB 분리 - 118개 MNG 전용 테이블 connection 설정
- config/database.php에 codebridge connection 추가
- 78개 MNG 전용 모델에 $connection = 'codebridge' 설정
  - Admin (15): PM, 로드맵, API Explorer
  - Sales (16): 영업파트너, 수수료, 가망고객
  - Finance (9): 법인카드, 자금관리, 홈택스
  - Barobill (12): 은행/카드 동기화 관리
  - Interview (1), ESign (6), Equipment (2)
  - AI (3), Audit (3), 기타 (11)
2026-03-07 11:27:18 +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);
}
}