Files
sam-manage/app/Models/Barobill/BarobillSetting.php
pro ec9bcbe906 feat:바로빌 설정 페이지에 서비스 이용 옵션 체크박스 추가
- 4가지 서비스 옵션 체크박스 추가 (전자세금계산서, 계좌조회, 카드사용내역, 홈텍스매입/매출)
- BarobillSetting 모델 및 BarobillSettingController 생성
- 설정 API 라우트 추가 (/api/admin/barobill/settings)
- 담당자 정보 입력 필드 추가 (이름, 연락처, 이메일)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-22 16:51:56 +09:00

70 lines
1.6 KiB
PHP

<?php
namespace App\Models\Barobill;
use App\Models\Tenants\Tenant;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
class BarobillSetting extends Model
{
protected $table = 'barobill_settings';
protected $fillable = [
'tenant_id',
'corp_num',
'cert_key',
'barobill_id',
'corp_name',
'ceo_name',
'addr',
'biz_type',
'biz_class',
'contact_id',
'contact_name',
'contact_tel',
'is_active',
'auto_issue',
'use_tax_invoice',
'use_bank_account',
'use_card_usage',
'use_hometax',
'verified_at',
'created_by',
'updated_by',
];
protected $casts = [
'is_active' => 'boolean',
'auto_issue' => 'boolean',
'use_tax_invoice' => 'boolean',
'use_bank_account' => 'boolean',
'use_card_usage' => 'boolean',
'use_hometax' => 'boolean',
'verified_at' => 'datetime',
'created_at' => 'datetime',
'updated_at' => 'datetime',
];
/**
* 테넌트 관계
*/
public function tenant(): BelongsTo
{
return $this->belongsTo(Tenant::class);
}
/**
* 활성화된 서비스 목록 반환
*/
public function getActiveServicesAttribute(): array
{
$services = [];
if ($this->use_tax_invoice) $services[] = 'tax_invoice';
if ($this->use_bank_account) $services[] = 'bank_account';
if ($this->use_card_usage) $services[] = 'card_usage';
if ($this->use_hometax) $services[] = 'hometax';
return $services;
}
}