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

@@ -138,13 +138,13 @@ class IncidentController extends Controller
null
));
} catch (ValidationException $e) {
return cachet_route('dashboard.incidents.create')
return cachet_redirect('dashboard.incidents.create')
->withInput(Binput::all())
->withTitle(sprintf('%s %s', trans('dashboard.notifications.whoops'), trans('dashboard.incidents.add.failure')))
->withErrors($e->getMessageBag());
}
return cachet_route('dashboard.incidents')
return cachet_redirect('dashboard.incidents')
->withSuccess(sprintf('%s %s', trans('dashboard.notifications.awesome'), trans('dashboard.incidents.add.success')));
}
@@ -184,7 +184,7 @@ class IncidentController extends Controller
{
$template->delete();
return cachet_route('dashboard.templates')
return cachet_redirect('dashboard.templates')
->withSuccess(sprintf('%s %s', trans('dashboard.notifications.awesome'), trans('dashboard.incidents.templates.delete.success')));
}
@@ -198,13 +198,13 @@ class IncidentController extends Controller
try {
IncidentTemplate::create(Binput::get('template'));
} catch (ValidationException $e) {
return cachet_route('dashboard.templates.create')
return cachet_redirect('dashboard.templates.create')
->withInput(Binput::all())
->withTitle(sprintf('%s %s', trans('dashboard.notifications.whoops'), trans('dashboard.incidents.templates.add.failure')))
->withErrors($e->getMessageBag());
}
return cachet_route('dashboard.templates')
return cachet_redirect('dashboard.templates')
->withSuccess(sprintf('%s %s', trans('dashboard.notifications.awesome'), trans('dashboard.incidents.templates.add.success')));
}
@@ -219,7 +219,7 @@ class IncidentController extends Controller
{
dispatch(new RemoveIncidentCommand($incident));
return cachet_route('dashboard.incidents')
return cachet_redirect('dashboard.incidents')
->withSuccess(sprintf('%s %s', trans('dashboard.notifications.awesome'), trans('dashboard.incidents.delete.success')));
}
@@ -264,7 +264,7 @@ class IncidentController extends Controller
null
));
} catch (ValidationException $e) {
return cachet_route('dashboard.incidents.edit', ['id' => $incident->id])
return cachet_redirect('dashboard.incidents.edit', ['id' => $incident->id])
->withInput(Binput::all())
->withTitle(sprintf('%s %s', trans('dashboard.notifications.whoops'), trans('dashboard.incidents.templates.edit.failure')))
->withErrors($e->getMessageBag());
@@ -274,7 +274,7 @@ class IncidentController extends Controller
$incident->component->update(['status' => Binput::get('component_status')]);
}
return cachet_route('dashboard.incidents.edit', ['id' => $incident->id])
return cachet_redirect('dashboard.incidents.edit', ['id' => $incident->id])
->withSuccess(sprintf('%s %s', trans('dashboard.notifications.awesome'), trans('dashboard.incidents.edit.success')));
}
@@ -290,12 +290,12 @@ class IncidentController extends Controller
try {
$template->update(Binput::get('template'));
} catch (ValidationException $e) {
return cachet_route('dashboard.templates.edit', ['id' => $template->id])
return cachet_redirect('dashboard.templates.edit', ['id' => $template->id])
->withUpdatedTemplate($template)
->withTemplateErrors($e->getMessageBag()->getErrors());
}
return cachet_route('dashboard.templates.edit', ['id' => $template->id])
return cachet_redirect('dashboard.templates.edit', ['id' => $template->id])
->withUpdatedTemplate($template);
}
@@ -328,13 +328,13 @@ class IncidentController extends Controller
$this->auth->user()
));
} catch (ValidationException $e) {
return cachet_route('dashboard.incidents.update', ['id' => $incident->id])
return cachet_redirect('dashboard.incidents.update', ['id' => $incident->id])
->withInput(Binput::all())
->withTitle(sprintf('%s %s', trans('dashboard.notifications.whoops'), trans('dashboard.incidents.templates.edit.failure')))
->withErrors($e->getMessageBag());
}
return cachet_route('dashboard.incidents')
return cachet_redirect('dashboard.incidents')
->withSuccess(sprintf('%s %s', trans('dashboard.notifications.awesome'), trans('dashboard.incidents.delete.success')));
}
}