Reputation: 1183
I try to redirect to a resource route with paramateres in my laravel controller
Redirect::route('users.show', array('user'=> $user->account_id));
but the parameter is never getting passed through.
What I'm doing wrong?
Upvotes: 1
Views: 3330
Reputation: 11
You have to add "return" keyword before "redirect". Try like this
return redirect()->route('users.show', $user->account_id);
Upvotes: 0
Reputation: 4114
It should work. May be you are passing a null value.
Check the value of $user->account_id
using dd($user->account_id);
Upvotes: 0
Reputation:
You can Try like this
redirect()->route('users.show', ['user'=> $user->account_id]);
Upvotes: 2
Reputation: 250
Try to use this:
Redirect::route('users.show', ["user" => $user->account_id]);
Upvotes: 0