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

@@ -87,13 +87,13 @@ class TeamController extends Controller
Binput::get('level')
));
} catch (ValidationException $e) {
return cachet_route('dashboard.team.create')
return cachet_redirect('dashboard.team.create')
->withInput(Binput::except('password'))
->withTitle(sprintf('%s %s', trans('dashboard.notifications.whoops'), trans('dashboard.team.add.failure')))
->withErrors($e->getMessageBag());
}
return cachet_route('dashboard.team.create')
return cachet_redirect('dashboard.team.create')
->withSuccess(sprintf('%s %s', trans('dashboard.notifications.awesome'), trans('dashboard.team.add.success')));
}
@@ -111,13 +111,13 @@ class TeamController extends Controller
try {
$user->update($userData);
} catch (ValidationException $e) {
return cachet_route('dashboard.team.edit', [$user->id])
return cachet_redirect('dashboard.team.edit', [$user->id])
->withInput($userData)
->withTitle(sprintf('%s %s', trans('dashboard.notifications.whoops'), trans('dashboard.team.edit.failure')))
->withErrors($e->getMessageBag());
}
return cachet_route('dashboard.team.edit', [$user->id])
return cachet_redirect('dashboard.team.edit', [$user->id])
->withSuccess(sprintf('%s %s', trans('dashboard.notifications.awesome'), trans('dashboard.team.edit.success')));
}
@@ -133,13 +133,13 @@ class TeamController extends Controller
array_unique(array_filter((array) Binput::get('emails')))
));
} catch (ValidationException $e) {
return cachet_route('dashboard.team.invite')
return cachet_redirect('dashboard.team.invite')
->withInput(Binput::except('password'))
->withTitle(sprintf('%s %s', trans('dashboard.notifications.whoops'), trans('dashboard.team.invite.failure')))
->withErrors($e->getMessageBag());
}
return cachet_route('dashboard.team.invite')
return cachet_redirect('dashboard.team.invite')
->withSuccess(sprintf('%s %s', trans('dashboard.notifications.awesome'), trans('dashboard.team.invite.success')));
}
@@ -154,7 +154,7 @@ class TeamController extends Controller
{
dispatch(new RemoveUserCommand($user));
return cachet_route('dashboard.team')
return cachet_redirect('dashboard.team')
->withSuccess(sprintf('%s %s', trans('dashboard.notifications.awesome'), trans('dashboard.team.delete.success')));
}
}