From 80caeea86a83dfc4c2747440532faf204bb18c20 Mon Sep 17 00:00:00 2001 From: James Brooks Date: Mon, 21 Sep 2015 11:21:03 +0100 Subject: [PATCH] Check that $incidentDate is set before using it --- app/Http/Controllers/Dashboard/IncidentController.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/app/Http/Controllers/Dashboard/IncidentController.php b/app/Http/Controllers/Dashboard/IncidentController.php index b8ea80ca7..64406f0c6 100644 --- a/app/Http/Controllers/Dashboard/IncidentController.php +++ b/app/Http/Controllers/Dashboard/IncidentController.php @@ -126,10 +126,12 @@ class IncidentController extends Controller Binput::get('notify', true) )); - $incident->update([ - 'created_at' => $incidentDate, - 'updated_at' => $incidentDate, - ]); + if (isset($incidentDate)) { + $incident->update([ + 'created_at' => $incidentDate, + 'updated_at' => $incidentDate, + ]); + } } catch (ValidationException $e) { return Redirect::route('dashboard.incidents.add') ->withInput(Binput::all())