In Codeigniter, I used the view function after posting the data. As shown below;
Ex: I have a show_products () function that displays a list of products. When the user adds a new product, I send the data to the add_product () function. If the process is successful, I do not redirect to the product page, instead I load the display function inside add_product () as follows:
if(success){
$this->show_products();
}
I think it makes no sense to reload the page again. Since we are already in the post function, we can immediately set the view after inserting the database.
However, in laravel, I see people being redirected after posting data.
Example:
if(success){
return Redirect::to('products');
}
I tried;
if(success){
$this->getIndex();
}
but it didn’t work.
, post ?
, ?
!