コード例 #1
0
ファイル: MetricController.php プロジェクト: n0mer/Cachet
 /**
  * Edit an metric.
  *
  * @param \CachetHQ\Cachet\Models\Metric $metric
  *
  * @return \Illuminate\Http\RedirectResponse
  */
 public function editMetricAction(Metric $metric)
 {
     $metricData = Binput::get('metric', null, false);
     $metric->update($metricData);
     if (!$metric->isValid()) {
         return Redirect::back()->withInput(Binput::all())->with('title', sprintf('<strong>%s</strong>', trans('dashboard.notifications.awesome')))->with('errors', $metric->getErrors());
     }
     $successMsg = sprintf('%s %s', trans('dashboard.notifications.awesome'), trans('dashboard.metrics.edit.success'));
     return Redirect::to('dashboard/metrics')->with('success', $successMsg);
 }