Route::post(\"/{user}/{char_name}\", array(
\'as\' => \'char-profile-post\',
\'uses\' => \'ProfileController@postDropDownL
Ok, so here is how I partially resolved my issue.
Route::group(array('prefix' => 'user'), function()
{
Route::post('/{user}/{char_name}/selectedok', array(
'as' => 'char-profile-post',
'uses' => 'ProfileController@postDropDownList'));
Route::get('/{user}/{char_name}/selectedok', array(
'as' => 'char-profile-get',
'uses' => 'ProfileController@getDropDownList'));
});
public function getDropDownList() {
return View::make('layout.profile');
}
public function postDropDownList($user, $char_name) {
if (Auth::check())
{
$user = Auth::user();
$selected_char = Input::get('choose');
$char_name = User::find($user->id)->characters()->where('char_name', '=', $selected_char)->first();
return Redirect::route('char-profile-get', array($user->username, $char_name->char_dynasty, $char_name->char_name))
->with('user', $user->username)
->with('charname', $char_name->char_name)
->with('dynastyname', $char_name->char_dynasty);
}
}
Yes I know I redirect to 'char-profile-get' with 3 parametres, but I only need 2. It doesn't bother me. As you observe, I redirect with ->with. The only way I will print the data in the view is by doing this in the view:
Your chosen character is {{ Session::get('charname') }} {{ Session::get('dynastyname')}}
If I don't overwrite the variables in postDropDownList($user, $char_name) my URL will literally look like this:
http://localhost/CaughtMiddle/tutorial/public/index.php/user/%7Buser%7D/%7Bchar_name%7D/selectedok
instead of this:
http://localhost/CaughtMiddle/tutorial/public/index.php/user/SerbanSpire/Spirescu/selectedok?Serban
So the verdict. The parametres in the functions will never receive any data. I don't even know how to describe them, the variables are inexistent, even if I redirect to the get route with the correct data. var_dump($user) or var_dump($char_name) doesn't print anything on the browser, dd($user) dd($char_name) also doesn't print anything nor does print_r().
Is my solution a viable one? By redirecting using ->with and storing the data in Session? Because this solution will drive me into using Session::get() alot! Stop me if I am wrong.