How to redirect with id in laravel?

Member

by brandy , in category: PHP Frameworks , 9 months ago

How to redirect with id in laravel?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

by muriel.schmidt , 9 months ago

@brandy 

You can redirect with an ID in Laravel using the route() method and passing the ID as a parameter. Here's an example:

1
return redirect()->route('user.show', ['id' => $user->id]);


In this example, user.show is the name of the route and $user->id is the ID that you want to pass as a parameter. Make sure to replace user.show with the actual name of the route in your application.

Related Threads:

How to get id after insert in Laravel?
How to generate the unique id in laravel?
How to remove id from url in laravel?
How to get last inserted id in laravel?
How to return last added id in laravel?
How to get the id of inserted row in laravel?