Files
sam-api/app/Http/Requests/V1/Payment/PaymentIndexRequest.php

33 lines
983 B
PHP
Raw Permalink Normal View History

<?php
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;
}
public function rules(): array
{
return [
'status' => ['nullable', 'string', Rule::in(Payment::STATUSES)],
'payment_method' => ['nullable', 'string', Rule::in(Payment::PAYMENT_METHODS)],
'start_date' => ['nullable', 'date'],
'end_date' => ['nullable', 'date', 'after_or_equal:start_date'],
'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'],
];
}
}