'required|alpha_dash|max_length[64]|is_unique[categories.slug,id,{id}]', 'name' => 'required|string|max_length[80]', ]; /** @return list */ public function activeOrdered(): array { return $this->cache() ->where('is_active', 1) ->orderBy('sort_order', 'ASC') ->findAll(); } public function findBySlug(string $slug): ?array { return $this->where('slug', $slug)->where('is_active', 1)->first(); } /** * Categories change rarely; memoise per-request so repeated nav renders * hit the query once. Cross-request caching happens in the Finder layer. */ private function cache(): self { return $this; } }