'required|string|max:255', 'description' => 'nullable|string|max:5000', 'taskable_type' => 'nullable|required_with:taskable_id|in:lead,contact,company,deal,call,campaign', 'taskable_id' => 'nullable|required_with:taskable_type|integer|min:1', 'assigned_to' => 'nullable|integer|exists:users,id', 'priority' => ['nullable', Rule::enum(TaskPriority::class)], 'due_at' => 'nullable|date', 'reminder_at' => 'nullable|date', 'parent_task_id' => 'nullable|integer|exists:tasks,id', 'estimated_minutes' => 'nullable|integer|min:1|max:100000', 'visibility' => ['nullable', Rule::enum(TaskVisibility::class)], ]; } public function after(): array { return [function (Validator $validator): void { if ($this->filled('reminder_at') && $this->filled('due_at') && $this->date('reminder_at')->gt($this->date('due_at'))) { $validator->errors()->add('reminder_at', 'زمان یادآوری نمی‌تواند بعد از موعد کار باشد.'); } }]; } }