0
我有一個控制器,它保存我的表單數據,並保存後,我試圖將我的頁面重定向到另一個form.But數據後,但重定向部分不工作形式。這是我的保存控制器代碼。 從laravel 4中的另一個控制器調用控制器不工作
class CompanyRegistrationController extends BaseController { public function saveAndCreateCompany() { // my code which gets form data and saves in database. //After that i am trying to redirect this to another page. To acheive this i am trying to do this. App::make('AddMoreEmployeeController')->showAddMoreEmployeeDetails(); } } // My new page code class AddMoreEmployeeController extends BaseController { public function showAddMoreEmployeeDetails() { return View::make('company.addEmployee'); } } Routes.php code Route::post('/companyCreatedSuccessfully', array('uses' => '[email protected]','as' => 'saveAndCreateCompany')); Route::get('/addMoreEmployeeDetails', array('uses' => '[email protected]','as' => 'showAddMoreEmployeeDetails'));但填寫表格詳細信息後,我沒有重定向到「addMoreEmployeeDetails」。 我仍然在companyCreatedSuccessfully與空白頁。但成功保存數據在 數據庫我需要重定向到addMoreEmployeeDetails。 我哪裏錯了?
是的,我這樣做,現在對我來說新頁面正在顯示。但url不chnaging。它仍然顯示/ companyCreatedSuccessfully。但我需要/ addMoreEmployeeDetails這個URL。 – user3408779 2014-11-06 07:53:38
@ user3408779我編輯了我的答案 – 2014-11-06 07:56:37
謝謝,這對我很有用。 :) – user3408779 2014-11-06 08:07:46