Fixed redirects with “cachet_redirect” helper

This commit is contained in:
Davide Bellini
2016-10-13 09:51:44 +02:00
parent aff834cac0
commit 05f93e16e8
13 changed files with 83 additions and 62 deletions

View File

@@ -82,13 +82,13 @@ class MetricController extends Controller
$metricData['threshold']
));
} catch (ValidationException $e) {
return cachet_route('dashboard.metrics.create')
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_route('dashboard.metrics')
return cachet_redirect('dashboard.metrics')
->withSuccess(sprintf('%s %s', trans('dashboard.notifications.awesome'), trans('dashboard.metrics.add.success')));
}
@@ -114,7 +114,7 @@ class MetricController extends Controller
{
dispatch(new RemoveMetricCommand($metric));
return cachet_route('dashboard.metrics')
return cachet_redirect('dashboard.metrics')
->withSuccess(sprintf('%s %s', trans('dashboard.notifications.awesome'), trans('dashboard.metrics.delete.success')));
}
@@ -155,13 +155,13 @@ class MetricController extends Controller
Binput::get('threshold', null, false)
));
} catch (ValidationException $e) {
return cachet_route('dashboard.metrics.edit', [$metric->id])
return cachet_redirect('dashboard.metrics.edit', [$metric->id])
->withInput(Binput::all())
->withTitle(sprintf('<strong>%s</strong>', trans('dashboard.notifications.whoops')))
->withErrors($e->getMessageBag());
}
return cachet_route('dashboard.metrics.edit', [$metric->id])
return cachet_redirect('dashboard.metrics.edit', [$metric->id])
->withSuccess(sprintf('%s %s', trans('dashboard.notifications.awesome'), trans('dashboard.metrics.edit.success')));
}
}