|string> */ public function rules(): array { $category = $this->route('category'); return [ 'name' => [ 'required', 'string', 'max:255', Rule::unique('categories', 'name') ->where(fn ($query) => $this->scopeUniqueToSiblings($query)) ->withoutTrashed() ->ignore($category), ], 'parent_id' => [ 'nullable', 'string', 'uuid', new ValidCategoryParent($category instanceof Category ? $category : null), ], 'icon' => ['required', 'string'], 'color' => [ 'required', 'string', Rule::enum(CategoryColor::class), ], 'type' => [ 'required', 'string', Rule::enum(CategoryType::class), ], 'cashflow_direction' => [ 'required', 'string', Rule::enum(CategoryCashflowDirection::class), ], ]; } }