Files
sam-api/app/Http/Requests/TaxInvoice/TaxInvoiceListRequest.php
kent 97f22f9b98 refactor(pagination): size 초과 시 오류 대신 자동 조정으로 변경
- config/pagination.php 추가 (기본값 중앙 관리)
- HasPagination Trait 추가 (prepareForValidation에서 자동 조정)
- 22개 IndexRequest에 Trait 적용, max 규칙 제거
- 특수 케이스: Employee($maxSize=500), Audit($maxSize=200)

size/per_page가 최대값 초과 시 422 오류 대신 최대값으로 자동 조정되어
리스트가 빈 화면으로 표시되는 문제 해결

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-13 19:45:44 +09:00

34 lines
1.1 KiB
PHP

<?php
namespace App\Http\Requests\TaxInvoice;
use App\Http\Requests\Traits\HasPagination;
use App\Models\Tenants\TaxInvoice;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;
class TaxInvoiceListRequest extends FormRequest
{
use HasPagination;
public function authorize(): bool
{
return true;
}
public function rules(): array
{
return [
'per_page' => ['nullable', 'integer', 'min:1'],
'direction' => ['nullable', 'string', Rule::in(TaxInvoice::DIRECTIONS)],
'status' => ['nullable', 'string', Rule::in(TaxInvoice::STATUSES)],
'invoice_type' => ['nullable', 'string', Rule::in(TaxInvoice::INVOICE_TYPES)],
'issue_type' => ['nullable', 'string', Rule::in(TaxInvoice::ISSUE_TYPES)],
'issue_date_from' => ['nullable', 'date'],
'issue_date_to' => ['nullable', 'date', 'after_or_equal:issue_date_from'],
'corp_num' => ['nullable', 'string', 'max:20'],
'corp_name' => ['nullable', 'string', 'max:100'],
'nts_confirm_num' => ['nullable', 'string', 'max:24'],
];
}
}