item($metricPoint); } /** * Create a new metric point. * * @param \CachetHQ\Cachet\Models\Metric $metric * * @return \Illuminate\Http\JsonResponse */ public function postMetricPoints(Metric $metric) { try { $metricPoint = dispatch(new CreateMetricPointCommand( $metric, Binput::get('value'), Binput::get('timestamp') )); } catch (QueryException $e) { throw new BadRequestHttpException(); } return $this->item($metricPoint); } /** * Updates a metric point. * * @param \CachetHQ\Cachet\Models\Metric $metric * @param \CachetHQ\Cachet\Models\MetircPoint $metricPoint * * @return \Illuminate\Http\JsonResponse */ public function putMetricPoint(Metric $metric, MetricPoint $metricPoint) { $metricPoint = dispatch(new UpdateMetricPointCommand( $metricPoint, $metric, Binput::get('value'), Binput::get('timestamp') )); return $this->item($metricPoint); } /** * Destroys a metric point. * * @param \CachetHQ\Cachet\Models\Metric $metric * @param \CachetHQ\Cachet\Models\MetricPoint $metricPoint * * @return \Illuminate\Http\JsonResponse */ public function deleteMetricPoint(Metric $metric, MetricPoint $metricPoint) { dispatch(new RemoveMetricPointCommand($metricPoint)); return $this->noContent(); } }