- 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>
32 lines
987 B
PHP
32 lines
987 B
PHP
<?php
|
|
|
|
namespace App\Http\Requests\V1\Subscription;
|
|
|
|
use App\Http\Requests\Traits\HasPagination;
|
|
use App\Models\Tenants\Subscription;
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
use Illuminate\Validation\Rule;
|
|
|
|
class SubscriptionIndexRequest extends FormRequest
|
|
{
|
|
use HasPagination;
|
|
|
|
public function authorize(): bool
|
|
{
|
|
return true;
|
|
}
|
|
|
|
public function rules(): array
|
|
{
|
|
return [
|
|
'status' => ['nullable', 'string', Rule::in(Subscription::STATUSES)],
|
|
'valid_only' => ['nullable', 'boolean'],
|
|
'expiring_within' => ['nullable', 'integer', 'min:1', 'max:365'],
|
|
'start_date' => ['nullable', 'date'],
|
|
'end_date' => ['nullable', 'date', 'after_or_equal:start_date'],
|
|
'sort_by' => ['nullable', 'string', 'in:started_at,ended_at,created_at'],
|
|
'sort_dir' => ['nullable', 'string', 'in:asc,desc'],
|
|
'per_page' => ['nullable', 'integer', 'min:1'],
|
|
];
|
|
}
|
|
} |