|string> */ public function rules(): array { return [ 'platform_instance_id' => 'required|exists:platform_instances,id', // name doubles as the Lemmy community slug (CreateChannelAction copies it // verbatim into channel_id for community lookup at publish time), so it must // be slug format and unique per instance — matching the Livewire create form. 'name' => [ 'required', 'string', 'max:255', 'regex:/^[a-z0-9_]+$/', Rule::unique('platform_channels', 'name') ->where('platform_instance_id', $this->input('platform_instance_id')), ], 'language_id' => 'nullable|exists:languages,id', 'description' => 'nullable|string', ]; } /** * @return array */ public function messages(): array { return [ 'name.regex' => 'The name must be a valid community slug (lowercase letters, numbers, and underscores only).', 'name.unique' => 'A channel with this name already exists for this instance.', ]; } }