⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠


profile picture

$crud->callbackAfterInsert Redirect


  • profile picture
  • Member

Posted 27 February 2021 - 00:15 AM

Hi! I'm having a problem with redirecting in grocery Crud 2 : I know that in grocery crud: callback_after_insert  I can excecute $this->crud->setLangString('insert_success_message',$data);

but in here the variable $this->crud or just $crud is unknown, so I can´t make the redirection. Others things that I've tried:


*return header("Location: ".$link );    (this one just doesnt redirect me, just excecute the save and go back to list like if the redirection weren´t there )

*return redirect()->to($link );                   (same that return header)


I'll apreciate some help  :D!!!





        $crud->callbackAfterInsert(function ($stateParameters
            $link = base_url()."/PuntoVenta/carrito";
            $data = "Your data has been successfully stored into the database.<br/>Please wait while you are redirecting to the another page.";
            $data .= "<script type='text/javascript'> window.location = '" . $link . "';</script><div style='display:none'></div>";
            return $stateParameters;