Laravel:返回视图而不是从基于路由返回


laravel : return view not return from based route

我在Laravel路由中有一个问题。我可以独立前往以下路线:

localhost/project/public/profile/profileSetup
localhost/project/public/thread/AddTrade

但是,如果我在路由localhost/project/public/thread/AddTrade上,如果我点击配置文件设置页面链接,我将被重定向到localhost/project/public/thread/profile/profileSetup路径而不是localhost/project/public/profile/profileSetup

In my controller:

return view('profile.profileSetup')->with('data',$userProfile);

In my route:

Route::get('profile/profileSetup', array('uses'=>'ProfileController@ProfileSetup'));

始终使用命名路由进行重定向。

这样定义路由:

 Route::get('profile/profileSetup', array('uses' => 'ProfileController@ProfileSetup','as'=>'myroute'));

和在你的视图:

<a href="{{{ URL::route('myroute') }}}"></a>

这将相应地设置href属性