> */ public function rules(): array { return [ 'name' => [ 'required', 'string', 'min:1', 'max:255', UniqueEloquent::make(Task::class, 'name', function (Builder $builder): Builder { /** @var Builder $builder */ return $builder->where('project_id', '=', $this->input('project_id')); })->withCustomTranslation('validation.task_name_already_exists'), ], 'project_id' => [ 'required', ExistsEloquent::make(Project::class, null, function (Builder $builder): Builder { /** @var Builder $builder */ return $builder->whereBelongsTo($this->organization, 'organization'); })->uuid(), ], // Estimated time in seconds 'estimated_time' => [ 'nullable', 'integer', 'min:0', 'max:2147483647', ], ]; } public function getEstimatedTime(): ?int { $input = $this->input('estimated_time'); return $input !== null && $input !== 0 ? (int) $this->input('estimated_time') : null; } }