laravel如何路由到同一控制器中的另一个功能 [英] laravel how to route to another function in the same controller
问题描述
我有一个注册控制器,当用户成功注册后,我想将他路由到他的个人资料页面.
I have a controller for registering, when the user register successfully I would like to route him to his profile page.
在用户控制器中,我具有以下功能:
In user controller I have these functions:
save
show($id)
注册时,用户触发save
功能.所以我的问题是如何将他路由到具有id的show
函数?
when registering, the user fires the save
function. so my question is how to route him to the show
function with the id ?
我可以制作view:make()
,但是我不想直接将他路由到视图,但是首先我想将他路由到show
函数来做一些事情,然后在show
函数中我做view.make
I could make view:make()
but I don't want to route him directly to the view but first I want to route him to the show
function to do some stuff and then in the show
function I do view.make
推荐答案
您可以使用重定向功能
如果您使用的是命名路由:
If you are using named routes:
return Redirect::route('profile', array($id));
如果不是:
return Redirect::to('user/show/' . $id);
这篇关于laravel如何路由到同一控制器中的另一个功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!