> */ public function rules(): array { return [ // ID of the user that the time entry should belong to 'user_id' => [ 'required', 'string', 'uuid', new ExistsEloquent(User::class, null, function (Builder $builder): Builder { /** @var Builder $builder */ return $builder->belongsToOrganization($this->organization); }), ], // 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_format:Y-m-d\TH:i:s\Z', ], // End of time entry (ISO 8601 format, UTC timezone) 'end' => [ 'nullable', 'date_format:Y-m-d\TH:i:s\Z', 'after:start', ], // Description of time entry 'description' => [ 'nullable', 'string', 'max:500', ], // 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'); }), ], ]; } }