Inheritance: extends Mage2\Framework\System\Models\BaseModel
 /**
  * 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);
 }
 public function view($slug)
 {
     $productsOnCategoryPage = Configuration::getConfiguration('mage2_catalog_no_of_product_category_page');
     $category = Category::where('slug', '=', $slug)->get()->first();
     $products = $category->products()->paginate($productsOnCategoryPage);
     return view('catalog.category.view')->with('category', $category)->with('products', $products);
 }
 private function _getCategoryOptions()
 {
     $options = Collection::make([0 => 'please select'] + Category::pluck('name', 'id')->toArray())->toArray();
     return $options;
 }
 public function _deleteTestCategory()
 {
     //@todo If we run test second time it will fail. (try to use data using faker).
     Category::where('slug', '=', 'test-category')->delete();
 }
 public function getCategoryOptions()
 {
     $options = Category::pluck('name', 'id');
     return $options;
 }