- account_codes 테이블 및 모델 생성 - 더존 표준 계정과목 163개 시더 추가 - 계정과목 CRUD API 추가 (추가/수정/삭제/조회) - 계정과목 설정 모달 UI 구현 - 분류별 필터링 및 검색 기능 - 사용/미사용 토글 기능 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
50 lines
980 B
PHP
50 lines
980 B
PHP
<?php
|
|
|
|
namespace App\Models\Barobill;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
use App\Models\Tenants\Tenant;
|
|
|
|
/**
|
|
* 계정과목 모델
|
|
*/
|
|
class AccountCode extends Model
|
|
{
|
|
protected $table = 'account_codes';
|
|
|
|
protected $fillable = [
|
|
'tenant_id',
|
|
'code',
|
|
'name',
|
|
'category',
|
|
'sort_order',
|
|
'is_active',
|
|
];
|
|
|
|
protected $casts = [
|
|
'is_active' => 'boolean',
|
|
'sort_order' => 'integer',
|
|
];
|
|
|
|
/**
|
|
* 테넌트 관계
|
|
*/
|
|
public function tenant(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Tenant::class);
|
|
}
|
|
|
|
/**
|
|
* 테넌트별 활성 계정과목 조회
|
|
*/
|
|
public static function getActiveByTenant(int $tenantId)
|
|
{
|
|
return self::where('tenant_id', $tenantId)
|
|
->where('is_active', true)
|
|
->orderBy('sort_order')
|
|
->orderBy('code')
|
|
->get();
|
|
}
|
|
}
|