component; $originalStatus = $component->status; event(new ComponentStatusWasUpdatedEvent($component, $originalStatus, $command->status)); $component->update($this->filter($command)); event(new ComponentWasUpdatedEvent($component)); return $component; } /** * Filter the command data. * * @param \CachetHQ\Cachet\Bus\Commands\Incident\UpdateComponentCommand $command * * @return array */ protected function filter(UpdateComponentCommand $command) { $params = [ 'name' => $command->name, 'description' => $command->description, 'link' => $command->link, 'status' => $command->status, 'enabled' => $command->enabled, 'order' => $command->order, 'group_id' => $command->group_id, 'meta' => $command->meta, ]; return array_filter($params, function ($val) { return $val !== null; }); } }