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

@ -99,7 +99,8 @@ class PersonController extends BaseController
$db->transComplete();
return redirect()->route('person-list');
return redirect()->route('person-list')
->with('message', lang('Person.messages.createSuccess'));
}
public function edit(): string
@ -145,13 +146,17 @@ class PersonController extends BaseController
->with('errors', $personModel->errors());
}
return redirect()->route('person-view', [$this->person->id]);
return redirect()->route('person-edit', [$this->person->id])->with(
'message',
lang('Person.messages.editSuccess')
);
}
public function delete(): RedirectResponse
{
(new PersonModel())->delete($this->person->id);
return redirect()->route('person-list');
return redirect()->route('person-list')
->with('message', lang('Person.messages.deleteSuccess'));
}
}