auth = $auth; } /** * Handle the add metric command. * * @param \CachetHQ\Cachet\Bus\Commands\Metric\CreateMetricCommand $command * * @return \CachetHQ\Cachet\Models\Metric */ public function handle(CreateMetricCommand $command) { $metric = Metric::create([ 'name' => $command->name, 'suffix' => $command->suffix, 'description' => $command->description, 'default_value' => $command->default_value, 'calc_type' => $command->calc_type, 'display_chart' => $command->display_chart, 'places' => $command->places, 'default_view' => $command->default_view, 'threshold' => $command->threshold, 'order' => $command->order, 'visible' => $command->visible, ]); event(new MetricWasCreatedEvent($this->auth->user(), $metric)); return $metric; } }