How to redirect with id in laravel?

Member

by brandy , in category: PHP Frameworks , 2 days ago

How to redirect with id in laravel?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

by muriel.schmidt , a day 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.