$incident_date is now handled by the command handler

This commit is contained in:
James Brooks
2015-09-26 14:42:42 +01:00
parent 3ca1ae5d70
commit 08e9705088
6 changed files with 53 additions and 34 deletions
@@ -13,8 +13,11 @@ namespace CachetHQ\Cachet\Handlers\Commands\Incident;
use CachetHQ\Cachet\Commands\Incident\UpdateIncidentCommand;
use CachetHQ\Cachet\Events\Incident\IncidentWasUpdatedEvent;
use CachetHQ\Cachet\Facades\Setting;
use CachetHQ\Cachet\Models\Component;
use CachetHQ\Cachet\Models\Incident;
use Illuminate\Support\Facades\Config;
use Jenssegers\Date\Date;
class UpdateIncidentCommandHandler
{
@@ -30,7 +33,10 @@ class UpdateIncidentCommandHandler
$incident = $command->incident;
$incident->update($this->filterIncidentData($command));
if ($incidentDate = $command->incident_date) {
// The incident occurred at a different time.
if ($command->incident_date) {
$incidentDate = Date::createFromFormat('d/m/Y H:i', $command->incident_date, Setting::get('app_timezone'))->setTimezone(Config::get('app.timezone'));
$incident->update([
'created_at' => $incidentDate,
'updated_at' => $incidentDate,