public function loadCategory() { if (!($slug = $this->property('category'))) { return null; } if (strpos($slug, '.') !== false) { $slug_parts = explode('.', $slug); $slug = array_pop($slug_parts); } if (!($category = ShopCategory::whereSlug($slug))) { return null; } return $category->first(); }
public function listCategories() { return $this->fillExtraData(ShopCategory::enabledAndVisible()->with('products')->getNested(), $this->controller->pageUrl($this->categoryPage, false)); }