/** * Ticket listing page. */ public function indexAction() { if ($this->currentUser->group->is_staff) { $tickets = Ticket::all(); } else { $tickets = Ticket::select()->where('user_id = ?', $this->currentUser->id)->fetchAll(); } $this->set(compact('tickets')); }
public function indexAction() { $information = ['tickets' => []]; // Tickets $information['tickets']['open'] = Ticket::select()->where('is_closed = ?', 0)->rowCount(); $information['tickets']['resolved'] = Ticket::select()->where('is_closed = ?', 1)->rowCount(); $information['tickets']['total'] = $information['tickets']['open'] + $information['tickets']['resolved']; // Tickets $information['users']['newest'] = User::select()->orderBy('id', 'DESC')->fetch(); $information['users']['total'] = User::select('id')->rowCount(); $this->set(compact('information')); }