> */ public function rules(): array { return [ // ID of the task that the time entry should belong to 'task_id' => [ 'nullable', 'string', 'uuid', new ExistsEloquent(Task::class, null, function (Builder $builder): Builder { /** @var Builder $builder */ return $builder->whereBelongsTo($this->organization, 'organization'); }), ], // Start of time entry (ISO 8601 format, UTC timezone) 'start' => [ 'required', 'date', // TODO ], // End of time entry (ISO 8601 format, UTC timezone) 'end' => [ 'required', 'nullable', 'date', // TODO 'after:start', ], // Description of time entry 'description' => [ 'nullable', 'string', 'max:255', ], // List of tag IDs 'tags' => [ 'nullable', 'array', ], 'tags.*' => [ 'string', 'uuid', new ExistsEloquent(Tag::class, null, function (Builder $builder): Builder { /** @var Builder $builder */ return $builder->whereBelongsTo($this->organization, 'organization'); }), ], ]; } }