From f05156412e51e7c3709730cb3bf99477df2b6bd7 Mon Sep 17 00:00:00 2001 From: James Brooks Date: Mon, 14 Nov 2016 18:26:44 +0000 Subject: [PATCH] Fix default occurred_at value --- .../Commands/Incident/ReportIncidentCommandHandler.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/Bus/Handlers/Commands/Incident/ReportIncidentCommandHandler.php b/app/Bus/Handlers/Commands/Incident/ReportIncidentCommandHandler.php index e951da4b..9aa7c295 100644 --- a/app/Bus/Handlers/Commands/Incident/ReportIncidentCommandHandler.php +++ b/app/Bus/Handlers/Commands/Incident/ReportIncidentCommandHandler.php @@ -19,6 +19,7 @@ use CachetHQ\Cachet\Dates\DateFactory; use CachetHQ\Cachet\Models\Component; use CachetHQ\Cachet\Models\Incident; use CachetHQ\Cachet\Models\IncidentTemplate; +use Carbon\Carbon; use Twig_Environment; use Twig_Loader_Array; @@ -78,10 +79,12 @@ class ReportIncidentCommandHandler // The incident occurred at a different time. if ($occurredAt = $command->occurred_at) { if ($date = $this->dates->create('Y-m-d H:i', $occurredAt)) { - $incident->fill(['occurred_at' => $date]); + $data['occurred_at'] = $date; } else { throw new InvalidIncidentTimestampException("Unable to pass timestamp {$occurredAt}"); } + } else { + $data['occurred_at'] = Carbon::now(); } // Create the incident