refactor: harmonize redirects after submitting forms

go back to form after submitting an edit form
This commit is contained in:
Yassine Doghri 2022-01-05 14:58:53 +00:00
commit d0cb964b0f
36 changed files with 179 additions and 57 deletions

View file

@ -166,7 +166,10 @@ class ContributorController extends BaseController
(int) $this->request->getPost('role'),
);
return redirect()->route('contributor-list', [$this->podcast->id]);
return redirect()->route('contributor-edit', [$this->podcast->id, $this->user->id])->with(
'message',
lang('Contributor.messages.editSuccess')
);
}
public function remove(): RedirectResponse
@ -174,7 +177,7 @@ class ContributorController extends BaseController
if ($this->podcast->created_by === $this->user->id) {
return redirect()
->back()
->with('errors', [lang('Contributor.messages.removeOwnerContributorError')]);
->with('errors', [lang('Contributor.messages.removeOwnerError')]);
}
$podcastModel = new PodcastModel();
@ -187,10 +190,10 @@ class ContributorController extends BaseController
}
return redirect()
->back()
->route('contributor-list', [$this->podcast->id])
->with(
'message',
lang('Contributor.messages.removeContributorSuccess', [
lang('Contributor.messages.removeSuccess', [
'username' => $this->user->username,
'podcastTitle' => $this->podcast->title,
]),