/** * Display all expenses from current tablet * for current user * * @return View */ public function all() { $userTablet = $this->_getCurrentTablet(); $expense = new Expense(); $expenses = $expense->getLastExpenses($userTablet->id); return View::make('expense/all', array('expenses' => $expenses, 'tablet' => $userTablet)); }
/** * Index action. Render dashboard with tablet * @return string */ public function index() { $userTablet = $this->_getCurrentTablet(); if ($userTablet) { $predictionsByValue = $userTablet->predictions()->orderBy('value', 'desc')->get(); $predictionsByName = $userTablet->predictions()->orderBy('name', 'asc')->get(); $expense = new Expense(); $lastExpenses = $expense->getLastExpenses($userTablet->id, 5); return View::make('dashboard/index', array('tablet' => $userTablet, 'predictions' => $predictionsByValue, 'lastExpenses' => $lastExpenses))->nest('predictionModal', 'dashboard.modal.prediction')->nest('expenseModal', 'dashboard.modal.expense', array('predictions' => $predictionsByName))->nest('incomeModal', 'dashboard.modal.income')->nest('economyModal', 'dashboard.modal.economy')->nest('closeTabletModal', 'dashboard.modal.closetablet'); } $tabletsSoFar = count($this->_getCurrentUser()->tablets()->getResults()); return View::make('dashboard/info', array('tabletsSoFar' => $tabletsSoFar)); }