Files
sam-manage/app/Models/Finance/CorporateCard.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

54 lines
1.1 KiB
PHP

<?php
namespace App\Models\Finance;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
class CorporateCard extends Model
{
use SoftDeletes;
protected $connection = 'codebridge';
protected $table = 'corporate_cards';
protected $fillable = [
'tenant_id',
'card_name',
'card_company',
'card_number',
'card_type',
'payment_day',
'credit_limit',
'current_usage',
'card_holder_name',
'actual_user',
'expiry_date',
'cvc',
'status',
'memo',
];
protected $casts = [
'payment_day' => 'integer',
'credit_limit' => 'decimal:2',
'current_usage' => 'decimal:2',
];
/**
* 활성 카드만 조회
*/
public function scopeActive($query)
{
return $query->where('status', 'active');
}
/**
* 특정 테넌트의 카드 조회
*/
public function scopeForTenant($query, $tenantId)
{
return $query->where('tenant_id', $tenantId);
}
}