Files
sam-manage/app/Models/BizCert.php
kent 534ffcfbc0 feat(mng): 사업자등록증 OCR 기능 구현
## 주요 변경사항
- BizCertController: 내부 API (OCR, CRUD)
- BizCertOcrService: Claude Vision API 연동, Tesseract.js 지원
- BizCert 모델 및 FormRequest 추가
- config/services.php에 Claude API 설정 추가

## 프론트엔드
- business-ocr.blade.php: layouts.app 레이아웃 적용
- JS/AI 토글 모드 (Tesseract.js / Claude Vision)
- 이미지 전처리 추가 (그레이스케일, 대비 강화, 이진화)
- SweetAlert2 연동 (토스트, 삭제 확인)

## API 엔드포인트
- POST /api/biz-cert/ocr - OCR 처리
- GET /api/biz-cert - 목록 조회
- POST /api/biz-cert - 저장
- DELETE /api/biz-cert/{id} - 삭제

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-16 01:56:49 +09:00

48 lines
937 B
PHP

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
/**
* 사업자등록증 OCR 데이터 모델
*/
class BizCert extends Model
{
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;
}
}