original_string: public function createMetricAction()
      {
          $metricData = Binput::get('metric');
  
          try {
              execute(new CreateMetricCommand(
                  $metricData['name'],
                  $metricData['suffix'],
                  $metricData['description'],
                  $metricData['default_value'],
                  $metricData['calc_type'],
                  $metricData['display_chart'],
                  $metricData['places'],
                  $metricData['default_view'],
                  $metricData['threshold'],
                  0, // Default order
                  $metricData['visible']
              ));
          } catch (ValidationException $e) {
              return cachet_redirect('dashboard.metrics.create')
                  ->withInput(Binput::all())
                  ->withTitle(sprintf('%s %s', trans('dashboard.notifications.whoops'), trans('dashboard.metrics.add.failure')))
                  ->withErrors($e->getMessageBag());
          }
  
          return cachet_redirect('dashboard.metrics')
              ->withSuccess(sprintf('%s %s', trans('dashboard.notifications.awesome'), trans('dashboard.metrics.add.success')));
      }
code: public function createMetricAction()
      {
          $metricData = Binput::get('metric');
  
          try {
              execute(new CreateMetricCommand(
                  $metricData['name'],
                  $metricData['suffix'],
                  $metricData['description'],
                  $metricData['default_value'],
                  $metricData['calc_type'],
                  $metricData['display_chart'],
                  $metricData['places'],
                  $metricData['default_view'],
                  $metricData['threshold'],
                  0, // Default order
                  $metricData['visible']
              ));
          } catch (ValidationException $e) {
              return cachet_redirect('dashboard.metrics.create')
                  ->withInput(Binput::all())
                  ->withTitle(sprintf('%s %s', trans('dashboard.notifications.whoops'), trans('dashboard.metrics.add.failure')))
                  ->withErrors($e->getMessageBag());
          }
  
          return cachet_redirect('dashboard.metrics')
              ->withSuccess(sprintf('%s %s', trans('dashboard.notifications.awesome'), trans('dashboard.metrics.add.success')));
      }
code_tokens: public function createMetricAction ( ) { $ metricData = Binput :: get ( 'metric' ) ; try { execute ( new CreateMetricCommand ( $ metricData [ 'name' ] , $ metricData [ 'suffix' ] , $ metricData [ 'description' ] , $ metricData [ 'default_value' ] , $ metricData [ 'calc_type' ] , $ metricData [ 'display_chart' ] , $ metricData [ 'places' ] , $ metricData [ 'default_view' ] , $ metricData [ 'threshold' ] , 0 , // Default order $ metricData [ 'visible' ] ) ) ; } catch ( ValidationException $ e ) { return cachet_redirect ( 'dashboard.metrics.create' ) -> withInput ( Binput :: all ( ) ) -> withTitle ( sprintf ( '%s %s' , trans ( 'dashboard.notifications.whoops' ) , trans ( 'dashboard.metrics.add.failure' ) ) ) -> withErrors ( $ e -> getMessageBag ( ) ) ; } return cachet_redirect ( 'dashboard.metrics' ) -> withSuccess ( sprintf ( '%s %s' , trans ( 'dashboard.notifications.awesome' ) , trans ( 'dashboard.metrics.add.success' ) ) ) ; }
docstring: Creates a new metric.
  
  @return \Illuminate\Http\RedirectResponse
docstring_tokens: Creates a new metric .