Files
portal-api/modules/DomainFluctuation/App/Http/Requests/IndexDomainFluctuationRequest.php
T
2026-07-01 10:51:05 +07:00

37 lines
1.2 KiB
PHP

<?php
namespace Modules\DomainFluctuation\App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
use Modules\DomainFluctuation\App\DTOs\DomainFluctuationFilterDTO;
class IndexDomainFluctuationRequest extends FormRequest
{
public function authorize(): bool
{
return true;
}
public function rules(): array
{
return [
'term_id' => ['nullable', 'integer'],
'keyword' => ['nullable', 'string', 'max:255'],
'ownerType' => ['nullable', 'in:C,T'],
'status' => ['nullable', 'integer', 'in:0,1'],
'action' => ['nullable', 'string', 'max:100'],
'from' => ['nullable', 'integer'],
'to' => ['nullable', 'integer'],
'per_page' => ['nullable', 'integer', 'min:1', 'max:200'],
'page' => ['nullable', 'integer', 'min:1'],
'sort_by' => ['nullable', 'in:id,domainName,registeredDate,expiredDate,actionDate,created_at'],
'sort_dir' => ['nullable', 'in:asc,desc'],
];
}
public function toDTO(): DomainFluctuationFilterDTO
{
return DomainFluctuationFilterDTO::fromArray($this->validated());
}
}