30 lines
931 B
PHP
30 lines
931 B
PHP
|
|
<?php
|
||
|
|
|
||
|
|
namespace App\Http\Requests\V1\Subscription;
|
||
|
|
|
||
|
|
use App\Models\Tenants\Subscription;
|
||
|
|
use Illuminate\Foundation\Http\FormRequest;
|
||
|
|
use Illuminate\Validation\Rule;
|
||
|
|
|
||
|
|
class SubscriptionIndexRequest extends FormRequest
|
||
|
|
{
|
||
|
|
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', 'max:100'],
|
||
|
|
];
|
||
|
|
}
|
||
|
|
}
|