|string> */ public function rules(): array { /** @var Project $project */ $project = $this->route('project'); return [ 'confirmation_key' => [ 'required', 'string', Rule::in([$project->key]), ], 'source_template_id' => [ 'required', 'integer', Rule::exists(ProjectTemplate::class, 'id')->where('is_published', true), Rule::notIn(array_filter([$project->project_template_id])), ], ]; } /** * @return array */ public function messages(): array { return [ 'confirmation_key.in' => 'Enter the exact project key to confirm the template switch.', 'source_template_id.not_in' => 'Choose a different published template to switch this project.', ]; } }