/** * Products Index */ public function index() { // Scoreboard queries $products['total'] = Product::all()->count(); $products['isActive'] = Product::isActive()->count(); $products['isInactive'] = $products['total'] - $products['isActive']; $products['inStock'] = Product::inStock()->count(); $products['outOfStock'] = $products['isActive'] - $products['inStock']; $products['isDiscounted'] = Product::isDiscounted()->isActive()->count(); $products['isFullPrice'] = $products['isActive'] - $products['isDiscounted']; $this->vars['products'] = $products; // Extend list controller $this->asExtension('ListController')->index(); }