/** * Load the list scoreboard data * * @return void */ public function loadScoreboard() { $total = Product::count(); $enabled = Product::isEnabled()->count(); $inStock = Product::inStock()->isEnabled()->count(); $outOfStock = Product::outOfStock()->isEnabled()->count(); $discounted = Product::discounted()->isEnabled()->count(); $averagePrice = Product::joinPrice()->isEnabled()->avg('price'); $disabled = $total - $enabled; $this->vars['scoreboard'] = ['total' => $total, 'enabled' => $enabled, 'disabled' => $disabled, 'inStock' => $inStock, 'outOfStock' => $outOfStock, 'averagePrice' => CurrencySettings::format($averagePrice)]; }