Meanwhile, a more interesting approach for me is to do something like this:
Route::group(array('prefix' => 'user/{user}'), function()
{
Route::get("/{char}", array(
'as' => 'profile-user',
'uses' => 'ProfileController@user'));
}
);
Controller:
public function user($user, $char) {
$user = User::where('username', '=', Session::get('theuser') );
$char = Character::where('char_name', '=', 'Cucu' );
if($user->count()) {
$user = $user->first();
$char = $char->first();
return View::make('layout.profile')
->with('user', $user)
->with('char', $char);
}
return App::abort(404);
}
It doesn't seem for me to be able to do something like this at the push of a button
$logged_user = Session::get('theuser');
return Redirect::route('profile-user', $logged_user);
because I can't put 2 parameters in the Redirect function. This code will get the URL
[this is not a link](http://localhost/tutorial/public/index.php/user/SerbanSpire)
which obviously doesn't exist
The correct URL would be
[this is not a link]http://localhost/CaughtMiddle/tutorial/public/index.php/user/SerbanSpire/Cucu)
where SerbanSpire is the $user and Cucu is $char. How can I get the correct URL?