- config/services.php에 barobill 설정 등록 (운영/테스트 모드 분기 정상화) - BarobillSetting 모델에 BelongsToTenant 적용 및 use_* 필드 casts 추가 - BarobillService API URL을 baroservice.com(SOAP)으로 수정 - BarobillService callApi 메서드 경로 하드코딩 제거 (서비스별 분기) - BarobillService 예외 이중 래핑 문제 수정 - BarobillController URL 메서드 중복 코드 제거 - 누락 모델 16개 생성 (MNG 패턴 준수, BelongsToTenant 적용) - 바로빌 전 테이블 options JSON 컬럼 추가 마이그레이션
83 lines
2.0 KiB
PHP
83 lines
2.0 KiB
PHP
<?php
|
|
|
|
namespace App\Models\Barobill;
|
|
|
|
use App\Traits\BelongsToTenant;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
|
|
|
class BarobillMember extends Model
|
|
{
|
|
use BelongsToTenant, SoftDeletes;
|
|
|
|
protected $table = 'barobill_members';
|
|
|
|
protected $fillable = [
|
|
'tenant_id',
|
|
'biz_no',
|
|
'corp_name',
|
|
'ceo_name',
|
|
'addr',
|
|
'biz_type',
|
|
'biz_class',
|
|
'barobill_id',
|
|
'barobill_pwd',
|
|
'manager_name',
|
|
'manager_email',
|
|
'manager_hp',
|
|
'status',
|
|
'server_mode',
|
|
'last_sales_fetch_at',
|
|
'last_purchases_fetch_at',
|
|
];
|
|
|
|
protected $casts = [
|
|
'barobill_pwd' => 'encrypted',
|
|
'last_sales_fetch_at' => 'datetime',
|
|
'last_purchases_fetch_at' => 'datetime',
|
|
];
|
|
|
|
protected $hidden = [
|
|
'barobill_pwd',
|
|
];
|
|
|
|
// =========================================================================
|
|
// 관계 정의
|
|
// =========================================================================
|
|
|
|
public function tenant(): BelongsTo
|
|
{
|
|
return $this->belongsTo(\App\Models\Tenants\Tenant::class);
|
|
}
|
|
|
|
// =========================================================================
|
|
// 접근자
|
|
// =========================================================================
|
|
|
|
public function getFormattedBizNoAttribute(): string
|
|
{
|
|
$num = $this->biz_no;
|
|
if (strlen($num) === 10) {
|
|
return substr($num, 0, 3).'-'.substr($num, 3, 2).'-'.substr($num, 5);
|
|
}
|
|
|
|
return $num ?? '';
|
|
}
|
|
|
|
public function getStatusLabelAttribute(): string
|
|
{
|
|
return match ($this->status) {
|
|
'active' => '활성',
|
|
'inactive' => '비활성',
|
|
'pending' => '대기',
|
|
default => $this->status,
|
|
};
|
|
}
|
|
|
|
public function isTestMode(): bool
|
|
{
|
|
return $this->server_mode === 'test';
|
|
}
|
|
}
|