- CorporateCard 모델 추가 - CorporateCardController API 추가 (CRUD) - 라우트 추가 (list, store, update, deactivate, destroy) - React 컴포넌트 API 연동 (fetch 호출) - 로딩 상태 UI 추가 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
53 lines
1.0 KiB
PHP
53 lines
1.0 KiB
PHP
<?php
|
|
|
|
namespace App\Models\Finance;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
|
|
|
class CorporateCard extends Model
|
|
{
|
|
use SoftDeletes;
|
|
|
|
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);
|
|
}
|
|
}
|