Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

Routes redirect

Hi, I have this route redirect and it works, but after->send() , I didn't get the flashMessages. I should use exit; after ->send() and everything works correctly.

No flashMsg:

$this->response->redirect(array("for" => "admin-company-acc-companies-add"));
$this->response->send();

Example (i get them):

$this->response->redirect(array("for" => "admin-company-acc-companies-add"));
$this->response->send();
exit;

Is it a bug or ?



84.5k
Accepted
answer

You have to return the response:

return $this->response->redirect(array("for" => "admin-company-acc-companies-add"));