- API 사용 테이블 22개(23개 모델) 제외하고 55개 모델만 $connection = 'codebridge' 적용 - config/database.php에 codebridge connection 재추가 - 제외 대상: Barobill 12개, ESign 4개, Audit 2개, DevTools 1개, System 2개, HR 1개
49 lines
979 B
PHP
49 lines
979 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
/**
|
|
* 사업자등록증 OCR 데이터 모델
|
|
*/
|
|
class BizCert extends Model
|
|
{
|
|
protected $connection = 'codebridge';
|
|
protected $table = 'biz_cert';
|
|
|
|
protected $fillable = [
|
|
'biz_no',
|
|
'company_name',
|
|
'representative',
|
|
'open_date',
|
|
'address',
|
|
'biz_type',
|
|
'biz_item',
|
|
'issue_date',
|
|
'raw_text',
|
|
'ocr_method',
|
|
];
|
|
|
|
protected function casts(): array
|
|
{
|
|
return [
|
|
'open_date' => 'date',
|
|
'issue_date' => 'date',
|
|
];
|
|
}
|
|
|
|
/**
|
|
* 사업자번호 포맷팅 (XXX-XX-XXXXX)
|
|
*/
|
|
public function getFormattedBizNoAttribute(): string
|
|
{
|
|
$no = preg_replace('/[^0-9]/', '', $this->biz_no);
|
|
if (strlen($no) === 10) {
|
|
return substr($no, 0, 3).'-'.substr($no, 3, 2).'-'.substr($no, 5, 5);
|
|
}
|
|
|
|
return $this->biz_no;
|
|
}
|
|
}
|