I have an issue in Laravel routing. I am able to go to the following routes independently:
localhost/project/public/profile/profileSetup
localhost/project/public/thread/AddTrade
But, if I am on the route localhost/project/public/thread/AddTrade
and if I click on the profile setup page link, I am redirected to localhost/project/public/thread/profile/profileSetup
path instead of 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'));
Always use named route to redirect.
Define Route like this:
Route::get('profile/profileSetup', array('uses' => 'ProfileController@ProfileSetup','as'=>'myroute'));
and in you view:
<a href="{{{ URL::route('myroute') }}}"></a>
This will set the href attribute accordingly.