getKey(); $rules = [ 'name' => ['sometimes', 'array'], 'name.de' => ['required_with:name', 'string', 'max:255'], 'name.en' => ['nullable', 'string', 'max:255'], 'description' => ['sometimes', 'array'], 'description.de' => ['nullable', 'string'], 'description.en' => ['nullable', 'string'], 'slug' => [ 'sometimes', 'string', 'max:255', Rule::unique('events', 'slug')->ignore($eventId), ], 'date' => ['sometimes', 'date'], 'location' => ['sometimes', 'nullable', 'string', 'max:255'], 'max_participants' => ['sometimes', 'nullable', 'integer', 'min:0'], 'event_type_id' => ['sometimes', 'nullable', 'integer', 'exists:event_types,id'], 'default_locale' => ['sometimes', 'string', 'max:5'], 'is_active' => ['sometimes', 'boolean'], 'status' => ['sometimes', 'string', Rule::in(['draft', 'published', 'archived'])], 'settings' => ['sometimes', 'array'], 'join_link_enabled' => ['sometimes', 'boolean'], 'photo_upload_enabled' => ['sometimes', 'boolean'], 'task_checklist_enabled' => ['sometimes', 'boolean'], ]; if ($action === 'create') { $rules['name'] = ['required', 'array']; $rules['name.de'] = ['required', 'string', 'max:255']; $rules['slug'] = [ 'required', 'string', 'max:255', Rule::unique('events', 'slug'), ]; $rules['date'] = ['required', 'date']; } return $rules; } public static function allowedFields(string $action): array { return [ 'name', 'description', 'slug', 'date', 'location', 'max_participants', 'event_type_id', 'default_locale', 'is_active', 'status', 'settings', 'join_link_enabled', 'photo_upload_enabled', 'task_checklist_enabled', ]; } }