route('category')?->id; return [ 'type' => ['required', Rule::in($this->typeOptions())], 'name' => ['required', 'string', 'max:120'], 'slug' => ['required', 'string', 'max:190', Rule::unique('categories', 'slug')->ignore($categoryId)], 'description' => ['nullable', 'string'], 'is_active' => ['nullable', 'boolean'], ]; } /** * @return array */ private function typeOptions(): array { $defaults = ['tool', 'model', 'news', 'guide']; $existing = Category::query()->distinct()->pluck('type')->filter()->values()->all(); return array_values(array_unique([...$defaults, ...$existing])); } }