CRM/backend/app/Http/Requests/TaskIndexRequest.php

36 خطوط
1.2 KiB
PHP

<?php
namespace App\Http\Requests;
use App\Enums\TaskPriority;
use App\Enums\TaskStatus;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;
class TaskIndexRequest extends FormRequest
{
public function authorize(): bool
{
return true;
}
public function rules(): array
{
return [
'status' => ['nullable', Rule::enum(TaskStatus::class)],
'priority' => ['nullable', Rule::enum(TaskPriority::class)],
'assigned_to' => 'nullable|integer|exists:users,id',
'created_by' => 'nullable|integer|exists:users,id',
'due_from' => 'nullable|date',
'due_to' => 'nullable|date|after_or_equal:due_from',
'overdue' => 'nullable|boolean',
'taskable_type' => 'nullable|string|in:lead,contact,company,deal,call,campaign',
'taskable_id' => 'nullable|integer|min:1',
'search' => 'nullable|string|max:120',
'sort' => 'nullable|string|in:created_at,-created_at,due_at,-due_at,priority,-priority',
'page' => 'nullable|integer|min:1',
'per_page' => 'nullable|integer|min:1|max:100',
];
}
}