79 lines
1.7 KiB
PHP
79 lines
1.7 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;
|
|
}
|
|
}
|