Exemplo n.º 1
0
 /**
  * Returns the rendered Blade templates.
  *
  * @return \Illuminate\View\View
  */
 public function showIndex()
 {
     $components = Component::orderBy('order')->orderBy('created_at')->get();
     $allIncidents = [];
     $incidentDays = Setting::get('app_incident_days') ?: 7;
     foreach (range(0, $incidentDays) as $i) {
         $date = Carbon::now()->subDays($i);
         $incidents = Incident::whereBetween('created_at', [$date->format('Y-m-d') . ' 00:00:00', $date->format('Y-m-d') . ' 23:59:59'])->orderBy('created_at', 'desc')->get();
         $allIncidents[] = ['date' => $date->format('jS F Y'), 'incidents' => $incidents];
     }
     return View::make('index', ['components' => $components, 'allIncidents' => $allIncidents, 'pageTitle' => Setting::get('app_name'), 'aboutApp' => Markdown::render(Setting::get('app_about'))]);
 }