Files
sam-manage/app/Models/ESign/EsignFieldTemplate.php
김보곤 8291cdc39b 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:31:27 +09:00

55 lines
1.2 KiB
PHP

<?php
namespace App\Models\ESign;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\HasMany;
class EsignFieldTemplate extends Model
{
protected $connection = 'codebridge';
protected $table = 'esign_field_templates';
protected $fillable = [
'tenant_id',
'name',
'description',
'category',
'file_path',
'file_name',
'file_hash',
'file_size',
'signer_count',
'variables',
'is_active',
'created_by',
];
protected $casts = [
'signer_count' => 'integer',
'variables' => 'array',
'is_active' => 'boolean',
];
public function scopeForTenant($query, $tenantId)
{
return $query->where('tenant_id', $tenantId);
}
public function scopeByCategory($query, $category)
{
return $query->where('category', $category);
}
public function items(): HasMany
{
return $this->hasMany(EsignFieldTemplateItem::class, 'template_id')->orderBy('sort_order');
}
public function creator(): BelongsTo
{
return $this->belongsTo(\App\Models\User::class, 'created_by');
}
}