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>
This commit is contained in:
@@ -2,10 +2,18 @@
|
||||
|
||||
namespace App\Http\Requests\Employee;
|
||||
|
||||
use App\Http\Requests\Traits\HasPagination;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class IndexRequest extends FormRequest
|
||||
{
|
||||
use HasPagination;
|
||||
|
||||
/**
|
||||
* 드롭다운 등 관리용 확장을 위해 최대 500개 허용
|
||||
*/
|
||||
protected int $maxSize = 500;
|
||||
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
@@ -21,7 +29,7 @@ public function rules(): array
|
||||
'sort_by' => 'nullable|in:created_at,name,employee_status,department_id',
|
||||
'sort_dir' => 'nullable|in:asc,desc',
|
||||
'page' => 'nullable|integer|min:1',
|
||||
'per_page' => 'nullable|integer|min:1|max:500', // 드롭다운 등 관리용 확장
|
||||
'per_page' => 'nullable|integer|min:1',
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user