Mage2\Catalog\Models\Category::getAllCategories PHP Method

getAllCategories() public method

public getAllCategories ( )
    public function getAllCategories()
    {
        $data = [];
        $rootCategories = $this->where('parent_id', '=', '0')->where('website_id', '=', $this->websiteId)->get();
        $data = $this->list_categories($rootCategories);
        return $data;
    }

Usage Example

 /**
  * 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);
 }