public function getAllCategories() { $data = []; $rootCategories = $this->where('parent_id', '=', '0')->where('website_id', '=', $this->websiteId)->get(); $data = $this->list_categories($rootCategories); return $data; }
/** * Bind data to the view. * * @param View $view * @return void */ public function compose(View $view) { $cart = count(Session::get('cart')); $categoryModel = new Category(); $baseCategories = $categoryModel->getAllCategories(); $view->with('categories', $baseCategories)->with('cart', $cart); }