@tuesdave dont you want your route to be:
/users/{user}
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Laravel 8 Intertia.js
Within my UserController::store() endpoint, I create a user and want to be redirected back to the newly created resource, /users/{id}.
According to the Laravel documentation, I can use the following:
return redirect()->route('users', ['id' => $user->id]);
or
return redirect()->route('users', [$user]);
The issue is that the redirect is returning an id query param /users?21, instead of a path /users/21
Any ideas as to why this is happening?
Here is the request triggered from the frontend:
POST /users
Status code: 302 found
and after resource creation
GET /users?25
Status 200 OK
Hi @tuesdave
I believe your route name is missing something. If you are using a resource controller for example, you should have something like this maybe:
return redirect()->route('users.show', $user);
To be able to tell to which of the specific users route are you trying to redirect.
Hope this helps
Please or to participate in this conversation.