From 1068d72eea2acc6b5b2b0c64dbb512dafc93e9ed Mon Sep 17 00:00:00 2001 From: Adrien Poupa Date: Thu, 6 Dec 2018 23:20:08 -0500 Subject: [PATCH] Eager load user on the incident page not to query twice --- app/Http/Controllers/Dashboard/IncidentController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Http/Controllers/Dashboard/IncidentController.php b/app/Http/Controllers/Dashboard/IncidentController.php index a64b361c..f3f0dd9f 100644 --- a/app/Http/Controllers/Dashboard/IncidentController.php +++ b/app/Http/Controllers/Dashboard/IncidentController.php @@ -75,7 +75,7 @@ class IncidentController extends Controller */ public function showIncidents() { - $incidents = Incident::orderBy('created_at', 'desc')->get(); + $incidents = Incident::with('user')->orderBy('created_at', 'desc')->get(); return View::make('dashboard.incidents.index') ->withPageTitle(trans('dashboard.incidents.incidents').' - '.trans('dashboard.dashboard'))