Reputation: 1762
Purpose: to redirect a specific route with an array value. I am not able to use View::make in my situation, which causes problem.
$value = 'Sarah';
$array_param = array(
'1' => 'a',
'2' => 'b'
);
return Redirect::route('myroute', array(
'name' => $value
));
Above is cool. But i cannot use $array_param with redirect route, which expects a string parameter, but i'm sending an array variable. Alternative way?
return Redirect::route('myroute', array(
'name' => $value,
'parameter' => $array_param
));
--update--
Route::post('myroute/{name}/{array_param}', array(
'as' => 'myroute',
'uses' => 'mycontroller@mymethod'
));
Upvotes: 1
Views: 7450
Reputation: 2536
What the version of Laravel do you have?
The code below works for me correctly on laravel 5.1. Maybe it'll help you.
public function store(Request $request)
{
$item = Item::find(1); // an example
return redirect()->route('item.show', ['id' => $item->id]);
}
and yes, the redirect to the post route looks very incorrect. Please try to use the redirect only to the GET routes.
Upvotes: 2