Name your routes. See the second code example… https://laravel.com/docs/8.x/routing#generating-urls-to-named-routes
Then do
return redirect()->route('profile');
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
My route is
Route::get('/responder/conversation/{listingId}/{responderId}', [MessagesController::class, 'responderconversation'])->name('responder.conversation');
Any my present return code. in the controller is
return view('frontend.messaging.conversation',compact('responder','listing','messages','user'));
I need to redirect to the route of the page with arguments else its storing the data twice. What will be the correct code for redirect () ?
The second parameter of route should be an array in your example. Like this…
… route('profile', ['id' => 1, 'photos' => 'yes']);
Please or to participate in this conversation.