Monday, 15 June 2015

Calling a Controller from another controller in laravel 4 not working -



Calling a Controller from another controller in laravel 4 not working -

i have controller saves form info , after saving info trying redirect page form.but redirection part not working form me. saving controller code. class companyregistrationcontroller extends basecontroller { public function saveandcreatecompany() { // code gets form info , saves in database. //after trying redirect page. acheive trying this. app::make('addmoreemployeecontroller')->showaddmoreemployeedetails(); } } // new page code class addmoreemployeecontroller extends basecontroller { public function showaddmoreemployeedetails() { homecoming view::make('company.addemployee'); } } routes.php code route::post('/companycreatedsuccessfully', array('uses' => 'companyregistrationcontroller@saveandcreatecompany','as' => 'saveandcreatecompany')); route::get('/addmoreemployeedetails', array('uses' => 'addmoreemployeecontroller@showaddmoreemployeedetails','as' => 'showaddmoreemployeedetails')); after filling form details not redirecting "addmoreemployeedetails" . still in companycreatedsuccessfully blank page.but after successful save info in database need redirect addmoreemployeedetails. did mistake?

the problem launch other controller nil result. need homecoming it:

return app::make('addmoreemployeecontroller')->showaddmoreemployeedetails();

and work.

edit

as want alter url, seems want create redirection controller, should use:

return redirect::action('addmoreemployeecontroller@showaddmoreemployeedetails');

laravel laravel-4 controller url-routing

No comments:

Post a Comment