public function sales() { $charts = array(); foreach (InvoiceItem::TotalPerMonth()->withoutStakeholders()->byKind()->get() as $item) { $charts[$item->kind ? $item->kind : self::LABEL_OTHERS][$item->period] = $item->total; } foreach ($charts as $name => $chart) { ksort($charts[$name]); } return View::make('stats.ca', array('charts' => $charts)); }