2016-02-19 46 views
0

蛞蝓重定向我有以下控制器:如何使用Laravel

public function postupdate($subject, $id) 

//my code 

return Redirect::route('webupdate'); // This code is wrong 

下面的路线是,我要重新导向,但我怎么重定向而包括从上面的控制器都蛞蝓?

路线:

Route::get('/updateweb/{subject}/{id}/', array('as' => 'webupdate', 'uses' => '[email protected]')); 

回答

0
return Redirect::route('webupdate', ['subject'=>$subject, 'id'=>$id]); 

OR

return Redirect::route('webupdate', [$subject, $id]); 
+0

它不工作。当我重定向时,我想要包含在网址中的slu gs。 btw即时通讯使用Laravel 4.2 – Billy

+0

尝试第一个选项。这将使用'$ subject'和'$ id'将用户重定向到roue'webupdate'。 –

+0

仍然无效 – Billy

0

只需

return Redirect::route('webupdate', array($subject, $id)); 

return Redirect::route('webupdate', array('subject' => $subject, 'id' => $id)); 

如果你只有一个金属块,你也可以做

return Redirect::route('routename', $id); 

了解更多关于Redirects in Laravel 4.2 here

+0

与我的答案有什么不同? –

+0

你现在添加了你的答案的关键。 @JilsonThomas – ahmet2106

+0

查看我的编辑历史。 :) –