public function indexAction() { $reportsService = new Reports(); $date = Carbon::now()->subYear(1); $totalsYear = $this->repository->getTotals($date); $graphData = $reportsService->getDataToAppointmentGraph($date); $lastTasks = $this->repository->getLastTasks(); $startDateAppointmentCheck = Carbon::now()->subMonth(1); $endDateAppointmentCheck = Carbon::now()->format('Y-m-d'); $datesWithPendingAppointment = $reportsService->getDaysWithPendingAppointmentHours($startDateAppointmentCheck, $endDateAppointmentCheck); $task = new Tasks(); $task->status = Tasks::STATUS_PENDING; return view('dashboard.index')->with('hoursGraph', json_encode($graphData['hoursGraph']))->with('tasksGraph', json_encode($graphData['tasksGraph']))->with('labelsGraph', json_encode($graphData['labelsGraph']))->with('lastTasks', $lastTasks)->with('statusLabels', self::$statusLabels)->with('task', $task)->with('redirect', 'dashboard')->with('totalsYear', $totalsYear)->with('daysPendingHourGraph', json_encode($datesWithPendingAppointment['hours']))->with('daysPendingHourPendingGraph', json_encode($datesWithPendingAppointment['hoursPending']))->with('daysPendingLabelsGraph', json_encode($datesWithPendingAppointment['date'])); }