- config/services.php에 barobill 설정 등록 (운영/테스트 모드 분기 정상화) - BarobillSetting 모델에 BelongsToTenant 적용 및 use_* 필드 casts 추가 - BarobillService API URL을 baroservice.com(SOAP)으로 수정 - BarobillService callApi 메서드 경로 하드코딩 제거 (서비스별 분기) - BarobillService 예외 이중 래핑 문제 수정 - BarobillController URL 메서드 중복 코드 제거 - 누락 모델 16개 생성 (MNG 패턴 준수, BelongsToTenant 적용) - 바로빌 전 테이블 options JSON 컬럼 추가 마이그레이션
50 lines
1.4 KiB
PHP
50 lines
1.4 KiB
PHP
<?php
|
|
|
|
namespace App\Models\Barobill;
|
|
|
|
use App\Traits\BelongsToTenant;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class BarobillBankTransactionOverride extends Model
|
|
{
|
|
use BelongsToTenant;
|
|
|
|
protected $table = 'barobill_bank_transaction_overrides';
|
|
|
|
protected $fillable = [
|
|
'tenant_id',
|
|
'unique_key',
|
|
'modified_summary',
|
|
'modified_cast',
|
|
];
|
|
|
|
// =========================================================================
|
|
// 스코프
|
|
// =========================================================================
|
|
|
|
public function scopeByUniqueKey($query, string $uniqueKey)
|
|
{
|
|
return $query->where('unique_key', $uniqueKey);
|
|
}
|
|
|
|
// =========================================================================
|
|
// 헬퍼 메서드
|
|
// =========================================================================
|
|
|
|
public static function getByUniqueKeys(int $tenantId, array $uniqueKeys)
|
|
{
|
|
return static::where('tenant_id', $tenantId)
|
|
->whereIn('unique_key', $uniqueKeys)
|
|
->get()
|
|
->keyBy('unique_key');
|
|
}
|
|
|
|
public static function saveOverride(int $tenantId, string $uniqueKey, ?string $modifiedSummary, ?string $modifiedCast): self
|
|
{
|
|
return static::updateOrCreate(
|
|
['tenant_id' => $tenantId, 'unique_key' => $uniqueKey],
|
|
['modified_summary' => $modifiedSummary, 'modified_cast' => $modifiedCast]
|
|
);
|
|
}
|
|
}
|