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,13 @@
|
||||
|
||||
namespace App\Http\Requests\Admin;
|
||||
|
||||
use App\Http\Requests\Traits\HasPagination;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class FcmHistoryRequest extends FormRequest
|
||||
{
|
||||
use HasPagination;
|
||||
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
@@ -18,7 +21,7 @@ public function rules(): array
|
||||
'status' => 'nullable|string|in:pending,sending,completed,failed',
|
||||
'from' => 'nullable|date',
|
||||
'to' => 'nullable|date|after_or_equal:from',
|
||||
'per_page' => 'nullable|integer|min:1|max:100',
|
||||
'per_page' => 'nullable|integer|min:1',
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -2,10 +2,13 @@
|
||||
|
||||
namespace App\Http\Requests\Admin;
|
||||
|
||||
use App\Http\Requests\Traits\HasPagination;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class FcmTokenListRequest extends FormRequest
|
||||
{
|
||||
use HasPagination;
|
||||
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
@@ -19,7 +22,7 @@ public function rules(): array
|
||||
'is_active' => 'nullable|boolean',
|
||||
'has_error' => 'nullable|boolean',
|
||||
'search' => 'nullable|string|max:100',
|
||||
'per_page' => 'nullable|integer|min:1|max:100',
|
||||
'per_page' => 'nullable|integer|min:1',
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -2,11 +2,14 @@
|
||||
|
||||
namespace App\Http\Requests\Approval;
|
||||
|
||||
use App\Http\Requests\Traits\HasPagination;
|
||||
use App\Models\Tenants\ApprovalForm;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class FormIndexRequest extends FormRequest
|
||||
{
|
||||
use HasPagination;
|
||||
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
@@ -22,8 +25,8 @@ public function rules(): array
|
||||
'search' => 'nullable|string|max:100',
|
||||
'sort_by' => 'nullable|string|in:created_at,name,code,category',
|
||||
'sort_dir' => 'nullable|string|in:asc,desc',
|
||||
'per_page' => 'nullable|integer|min:1|max:100',
|
||||
'per_page' => 'nullable|integer|min:1',
|
||||
'page' => 'nullable|integer|min:1',
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,10 +2,13 @@
|
||||
|
||||
namespace App\Http\Requests\Approval;
|
||||
|
||||
use App\Http\Requests\Traits\HasPagination;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class InboxIndexRequest extends FormRequest
|
||||
{
|
||||
use HasPagination;
|
||||
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
@@ -17,8 +20,8 @@ public function rules(): array
|
||||
'status' => 'nullable|string|in:requested,scheduled,completed,rejected',
|
||||
'sort_by' => 'nullable|string|in:created_at,drafted_at,completed_at,title',
|
||||
'sort_dir' => 'nullable|string|in:asc,desc',
|
||||
'per_page' => 'nullable|integer|min:1|max:100',
|
||||
'per_page' => 'nullable|integer|min:1',
|
||||
'page' => 'nullable|integer|min:1',
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,11 +2,14 @@
|
||||
|
||||
namespace App\Http\Requests\Approval;
|
||||
|
||||
use App\Http\Requests\Traits\HasPagination;
|
||||
use App\Models\Tenants\Approval;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class IndexRequest extends FormRequest
|
||||
{
|
||||
use HasPagination;
|
||||
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
@@ -21,8 +24,8 @@ public function rules(): array
|
||||
'search' => 'nullable|string|max:100',
|
||||
'sort_by' => 'nullable|string|in:created_at,drafted_at,completed_at,title,status',
|
||||
'sort_dir' => 'nullable|string|in:asc,desc',
|
||||
'per_page' => 'nullable|integer|min:1|max:100',
|
||||
'per_page' => 'nullable|integer|min:1',
|
||||
'page' => 'nullable|integer|min:1',
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,10 +2,13 @@
|
||||
|
||||
namespace App\Http\Requests\Approval;
|
||||
|
||||
use App\Http\Requests\Traits\HasPagination;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class LineIndexRequest extends FormRequest
|
||||
{
|
||||
use HasPagination;
|
||||
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
@@ -17,8 +20,8 @@ public function rules(): array
|
||||
'search' => 'nullable|string|max:100',
|
||||
'sort_by' => 'nullable|string|in:created_at,name,is_default',
|
||||
'sort_dir' => 'nullable|string|in:asc,desc',
|
||||
'per_page' => 'nullable|integer|min:1|max:100',
|
||||
'per_page' => 'nullable|integer|min:1',
|
||||
'page' => 'nullable|integer|min:1',
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,10 +2,13 @@
|
||||
|
||||
namespace App\Http\Requests\Approval;
|
||||
|
||||
use App\Http\Requests\Traits\HasPagination;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class ReferenceIndexRequest extends FormRequest
|
||||
{
|
||||
use HasPagination;
|
||||
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
@@ -17,8 +20,8 @@ public function rules(): array
|
||||
'is_read' => 'nullable|boolean',
|
||||
'sort_by' => 'nullable|string|in:created_at,drafted_at,completed_at,title',
|
||||
'sort_dir' => 'nullable|string|in:asc,desc',
|
||||
'per_page' => 'nullable|integer|min:1|max:100',
|
||||
'per_page' => 'nullable|integer|min:1',
|
||||
'page' => 'nullable|integer|min:1',
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,10 +2,13 @@
|
||||
|
||||
namespace App\Http\Requests\Attendance;
|
||||
|
||||
use App\Http\Requests\Traits\HasPagination;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class IndexRequest extends FormRequest
|
||||
{
|
||||
use HasPagination;
|
||||
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
@@ -23,7 +26,7 @@ public function rules(): array
|
||||
'sort_by' => 'nullable|in:base_date,status,created_at',
|
||||
'sort_dir' => 'nullable|in:asc,desc',
|
||||
'page' => 'nullable|integer|min:1',
|
||||
'per_page' => 'nullable|integer|min:1|max:100',
|
||||
'per_page' => 'nullable|integer|min:1',
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,10 +2,18 @@
|
||||
|
||||
namespace App\Http\Requests\Audit;
|
||||
|
||||
use App\Http\Requests\Traits\HasPagination;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class AuditLogIndexRequest extends FormRequest
|
||||
{
|
||||
use HasPagination;
|
||||
|
||||
/**
|
||||
* 감사 로그 조회용 확장 - 최대 200개 허용
|
||||
*/
|
||||
protected int $maxSize = 200;
|
||||
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
@@ -15,7 +23,7 @@ public function rules(): array
|
||||
{
|
||||
return [
|
||||
'page' => 'nullable|integer|min:1',
|
||||
'size' => 'nullable|integer|min:1|max:200',
|
||||
'size' => 'nullable|integer|min:1',
|
||||
'target_type' => 'nullable|string|max:100',
|
||||
'target_id' => 'nullable|integer|min:1',
|
||||
'action' => 'nullable|string|max:50',
|
||||
|
||||
@@ -2,10 +2,13 @@
|
||||
|
||||
namespace App\Http\Requests\Common;
|
||||
|
||||
use App\Http\Requests\Traits\HasPagination;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class PaginateRequest extends FormRequest
|
||||
{
|
||||
use HasPagination;
|
||||
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
@@ -15,7 +18,7 @@ public function rules(): array
|
||||
{
|
||||
return [
|
||||
'page' => 'nullable|integer|min:1',
|
||||
'size' => 'nullable|integer|min:1|max:100',
|
||||
'size' => 'nullable|integer|min:1',
|
||||
'q' => 'nullable|string|max:100',
|
||||
'sort' => 'nullable|string|in:id,code,name,created_at',
|
||||
'order' => 'nullable|string|in:asc,desc',
|
||||
@@ -26,7 +29,7 @@ public function validatedOrDefaults(): array
|
||||
{
|
||||
$v = $this->validated();
|
||||
$v['page'] = $v['page'] ?? 1;
|
||||
$v['size'] = $v['size'] ?? 20;
|
||||
$v['size'] = $v['size'] ?? config('pagination.default_size', 20);
|
||||
$v['order'] = $v['order'] ?? 'desc';
|
||||
|
||||
return $v;
|
||||
|
||||
@@ -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',
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,10 +2,13 @@
|
||||
|
||||
namespace App\Http\Requests\Labor;
|
||||
|
||||
use App\Http\Requests\Traits\HasPagination;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class LaborIndexRequest extends FormRequest
|
||||
{
|
||||
use HasPagination;
|
||||
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
@@ -20,7 +23,7 @@ public function rules(): array
|
||||
'start_date' => ['nullable', 'date'],
|
||||
'end_date' => ['nullable', 'date', 'after_or_equal:start_date'],
|
||||
'page' => ['nullable', 'integer', 'min:1'],
|
||||
'per_page' => ['nullable', 'integer', 'min:1', 'max:100'],
|
||||
'per_page' => ['nullable', 'integer', 'min:1'],
|
||||
'sort_by' => ['nullable', 'string', 'in:created_at,labor_number,category,min_m,max_m,labor_price'],
|
||||
'sort_dir' => ['nullable', 'string', 'in:asc,desc'],
|
||||
];
|
||||
@@ -34,4 +37,4 @@ public function messages(): array
|
||||
'end_date.after_or_equal' => __('validation.after_or_equal', ['attribute' => '종료일', 'date' => '시작일']),
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,10 +2,13 @@
|
||||
|
||||
namespace App\Http\Requests\Leave;
|
||||
|
||||
use App\Http\Requests\Traits\HasPagination;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class IndexRequest extends FormRequest
|
||||
{
|
||||
use HasPagination;
|
||||
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
@@ -23,8 +26,8 @@ public function rules(): array
|
||||
'department_id' => 'nullable|integer',
|
||||
'sort_by' => 'nullable|string|in:created_at,start_date,end_date,days,status',
|
||||
'sort_dir' => 'nullable|string|in:asc,desc',
|
||||
'per_page' => 'nullable|integer|min:1|max:100',
|
||||
'per_page' => 'nullable|integer|min:1',
|
||||
'page' => 'nullable|integer|min:1',
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,12 +2,15 @@
|
||||
|
||||
namespace App\Http\Requests\Loan;
|
||||
|
||||
use App\Http\Requests\Traits\HasPagination;
|
||||
use App\Models\Tenants\Loan;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
class LoanIndexRequest extends FormRequest
|
||||
{
|
||||
use HasPagination;
|
||||
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*/
|
||||
@@ -31,7 +34,7 @@ public function rules(): array
|
||||
'search' => ['nullable', 'string', 'max:100'],
|
||||
'sort_by' => ['nullable', 'string', Rule::in(['loan_date', 'amount', 'status', 'created_at'])],
|
||||
'sort_dir' => ['nullable', 'string', Rule::in(['asc', 'desc'])],
|
||||
'per_page' => ['nullable', 'integer', 'min:1', 'max:100'],
|
||||
'per_page' => ['nullable', 'integer', 'min:1'],
|
||||
];
|
||||
}
|
||||
|
||||
@@ -53,4 +56,4 @@ public function attributes(): array
|
||||
'per_page' => __('validation.attributes.per_page'),
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,12 +2,15 @@
|
||||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
use App\Http\Requests\Traits\HasPagination;
|
||||
use App\Models\Tenants\Position;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
class PositionRequest extends FormRequest
|
||||
{
|
||||
use HasPagination;
|
||||
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
@@ -22,7 +25,7 @@ public function rules(): array
|
||||
'type' => ['nullable', Rule::in([Position::TYPE_RANK, Position::TYPE_TITLE])],
|
||||
'is_active' => 'nullable|boolean',
|
||||
'q' => 'nullable|string|max:100',
|
||||
'per_page' => 'nullable|integer|min:1|max:100',
|
||||
'per_page' => 'nullable|integer|min:1',
|
||||
'page' => 'nullable|integer|min:1',
|
||||
];
|
||||
}
|
||||
|
||||
@@ -2,10 +2,13 @@
|
||||
|
||||
namespace App\Http\Requests\Pricing;
|
||||
|
||||
use App\Http\Requests\Traits\HasPagination;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class PriceIndexRequest extends FormRequest
|
||||
{
|
||||
use HasPagination;
|
||||
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
@@ -14,7 +17,7 @@ public function authorize(): bool
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'size' => 'nullable|integer|min:1|max:100',
|
||||
'size' => 'nullable|integer|min:1',
|
||||
'page' => 'nullable|integer|min:1',
|
||||
'q' => 'nullable|string|max:100',
|
||||
'item_type_code' => 'nullable|string|in:PRODUCT,MATERIAL',
|
||||
@@ -24,4 +27,4 @@ public function rules(): array
|
||||
'valid_at' => 'nullable|date',
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,11 +2,14 @@
|
||||
|
||||
namespace App\Http\Requests\Quote;
|
||||
|
||||
use App\Http\Requests\Traits\HasPagination;
|
||||
use App\Models\Quote\Quote;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class QuoteIndexRequest extends FormRequest
|
||||
{
|
||||
use HasPagination;
|
||||
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
@@ -15,9 +18,16 @@ public function authorize(): bool
|
||||
/**
|
||||
* 검증 전 데이터 전처리
|
||||
* - 쿼리 스트링의 "true"/"false" 문자열을 boolean으로 변환
|
||||
* - size/per_page 최대값 제한
|
||||
*/
|
||||
protected function prepareForValidation(): void
|
||||
{
|
||||
// HasPagination Trait의 페이지네이션 처리
|
||||
$maxSize = $this->maxSize ?? config('pagination.max_size', 100);
|
||||
if ($this->has('size') && $this->input('size') > $maxSize) {
|
||||
$this->merge(['size' => $maxSize]);
|
||||
}
|
||||
|
||||
if ($this->has('with_items')) {
|
||||
$this->merge([
|
||||
'with_items' => filter_var($this->with_items, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE),
|
||||
@@ -29,7 +39,7 @@ public function rules(): array
|
||||
{
|
||||
return [
|
||||
'page' => 'nullable|integer|min:1',
|
||||
'size' => 'nullable|integer|min:1|max:100',
|
||||
'size' => 'nullable|integer|min:1',
|
||||
'q' => 'nullable|string|max:100',
|
||||
'quote_type' => 'nullable|in:'.implode(',', Quote::TYPES),
|
||||
'status' => 'nullable|in:'.implode(',', [
|
||||
@@ -50,4 +60,4 @@ public function rules(): array
|
||||
'with_items' => 'nullable|boolean', // 수주 전환용 품목 포함 여부
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,12 +2,15 @@
|
||||
|
||||
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;
|
||||
@@ -16,7 +19,7 @@ public function authorize(): bool
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'per_page' => ['nullable', 'integer', 'min:1', 'max:100'],
|
||||
'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)],
|
||||
@@ -28,4 +31,4 @@ public function rules(): array
|
||||
'nts_confirm_num' => ['nullable', 'string', 'max:24'],
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
44
app/Http/Requests/Traits/HasPagination.php
Normal file
44
app/Http/Requests/Traits/HasPagination.php
Normal file
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Traits;
|
||||
|
||||
/**
|
||||
* 페이지네이션 공통 처리 Trait
|
||||
*
|
||||
* size 또는 per_page 파라미터가 maxSize를 초과하면 자동으로 maxSize로 조정합니다.
|
||||
* 오류를 발생시키지 않고 최대값으로 제한하여 빈 리스트 문제를 방지합니다.
|
||||
*
|
||||
* @property int|null $maxSize 최대 페이지 사이즈 (기본값: config('pagination.max_size'))
|
||||
*/
|
||||
trait HasPagination
|
||||
{
|
||||
/**
|
||||
* 검증 전 size/per_page 값을 maxSize 이하로 조정
|
||||
*/
|
||||
protected function prepareForValidation(): void
|
||||
{
|
||||
$maxSize = $this->maxSize ?? config('pagination.max_size', 100);
|
||||
|
||||
// size 파라미터 처리
|
||||
if ($this->has('size') && $this->input('size') > $maxSize) {
|
||||
$this->merge(['size' => $maxSize]);
|
||||
}
|
||||
|
||||
// per_page 파라미터 처리
|
||||
if ($this->has('per_page') && $this->input('per_page') > $maxSize) {
|
||||
$this->merge(['per_page' => $maxSize]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 페이지네이션 기본 규칙 반환
|
||||
*/
|
||||
protected function paginationRules(): array
|
||||
{
|
||||
return [
|
||||
'page' => 'nullable|integer|min:1',
|
||||
'size' => 'nullable|integer|min:1',
|
||||
'per_page' => 'nullable|integer|min:1',
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -2,10 +2,13 @@
|
||||
|
||||
namespace App\Http\Requests\UserInvitation;
|
||||
|
||||
use App\Http\Requests\Traits\HasPagination;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class ListInvitationRequest extends FormRequest
|
||||
{
|
||||
use HasPagination;
|
||||
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
@@ -18,8 +21,8 @@ public function rules(): array
|
||||
'search' => ['nullable', 'string', 'max:255'],
|
||||
'sort_by' => ['nullable', 'string', 'in:created_at,expires_at,email'],
|
||||
'sort_dir' => ['nullable', 'string', 'in:asc,desc'],
|
||||
'per_page' => ['nullable', 'integer', 'min:1', 'max:100'],
|
||||
'per_page' => ['nullable', 'integer', 'min:1'],
|
||||
'page' => ['nullable', 'integer', 'min:1'],
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,12 +2,15 @@
|
||||
|
||||
namespace App\Http\Requests\V1\AiReport;
|
||||
|
||||
use App\Http\Requests\Traits\HasPagination;
|
||||
use App\Models\Tenants\AiReport;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
class AiReportListRequest extends FormRequest
|
||||
{
|
||||
use HasPagination;
|
||||
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
@@ -16,7 +19,7 @@ public function authorize(): bool
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'per_page' => ['nullable', 'integer', 'min:1', 'max:100'],
|
||||
'per_page' => ['nullable', 'integer', 'min:1'],
|
||||
'report_type' => ['nullable', 'string', Rule::in(array_keys(AiReport::REPORT_TYPES))],
|
||||
'status' => ['nullable', 'string', Rule::in(array_keys(AiReport::STATUSES))],
|
||||
'start_date' => ['nullable', 'date'],
|
||||
@@ -35,4 +38,4 @@ public function messages(): array
|
||||
]),
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,12 +2,15 @@
|
||||
|
||||
namespace App\Http\Requests\V1\Company;
|
||||
|
||||
use App\Http\Requests\Traits\HasPagination;
|
||||
use App\Models\CompanyRequest;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
class CompanyRequestIndexRequest extends FormRequest
|
||||
{
|
||||
use HasPagination;
|
||||
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
@@ -22,8 +25,8 @@ public function rules(): array
|
||||
'end_date' => 'nullable|date|after_or_equal:start_date',
|
||||
'sort_by' => ['nullable', Rule::in(['created_at', 'company_name', 'status', 'processed_at'])],
|
||||
'sort_dir' => ['nullable', Rule::in(['asc', 'desc'])],
|
||||
'per_page' => 'nullable|integer|min:1|max:100',
|
||||
'per_page' => 'nullable|integer|min:1',
|
||||
'page' => 'nullable|integer|min:1',
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,12 +2,15 @@
|
||||
|
||||
namespace App\Http\Requests\V1\Payment;
|
||||
|
||||
use App\Http\Requests\Traits\HasPagination;
|
||||
use App\Models\Tenants\Payment;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
class PaymentIndexRequest extends FormRequest
|
||||
{
|
||||
use HasPagination;
|
||||
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
@@ -23,7 +26,7 @@ public function rules(): array
|
||||
'search' => ['nullable', 'string', 'max:100'],
|
||||
'sort_by' => ['nullable', 'string', 'in:created_at,paid_at,amount'],
|
||||
'sort_dir' => ['nullable', 'string', 'in:asc,desc'],
|
||||
'per_page' => ['nullable', 'integer', 'min:1', 'max:100'],
|
||||
'per_page' => ['nullable', 'integer', 'min:1'],
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,10 +2,13 @@
|
||||
|
||||
namespace App\Http\Requests\V1\Plan;
|
||||
|
||||
use App\Http\Requests\Traits\HasPagination;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class PlanIndexRequest extends FormRequest
|
||||
{
|
||||
use HasPagination;
|
||||
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
@@ -19,7 +22,7 @@ public function rules(): array
|
||||
'search' => ['nullable', 'string', 'max:100'],
|
||||
'sort_by' => ['nullable', 'string', 'in:price,name,created_at'],
|
||||
'sort_dir' => ['nullable', 'string', 'in:asc,desc'],
|
||||
'per_page' => ['nullable', 'integer', 'min:1', 'max:100'],
|
||||
'per_page' => ['nullable', 'integer', 'min:1'],
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,12 +2,15 @@
|
||||
|
||||
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;
|
||||
@@ -23,7 +26,7 @@ public function rules(): array
|
||||
'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', 'max:100'],
|
||||
'per_page' => ['nullable', 'integer', 'min:1'],
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
24
config/pagination.php
Normal file
24
config/pagination.php
Normal file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Default Pagination Size
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| 페이지네이션 기본 사이즈 설정
|
||||
|
|
||||
*/
|
||||
'default_size' => 20,
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Maximum Pagination Size
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| 페이지네이션 최대 사이즈 설정
|
||||
| 요청값이 이 값을 초과하면 자동으로 이 값으로 조정됨
|
||||
|
|
||||
*/
|
||||
'max_size' => 100,
|
||||
];
|
||||
Reference in New Issue
Block a user