Files
sam-api/app/Http/Requests/V1/Subscription/SubscriptionIndexRequest.php

33 lines
988 B
PHP
Raw Normal View History

<?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'],
];
}
}