Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

jukia's avatar
Level 1

How to send multiple parameter in route?

<action="{{route('supa'. $item->id.'/'.$item->product_id.')}}"

0 likes
2 replies
LaryAI's avatar
Level 58

To send multiple parameters in a route, you can simply add them to the route definition separated by slashes. For example:

Route::get('/users/{id}/{name}', function ($id, $name) {
    // Your code here
});

In this example, the route expects two parameters: id and name. You can access these parameters in the closure function using the same names as defined in the route definition.

If you want to generate a URL for this route, you can use the route helper function and pass in the parameters as an array:

$url = route('users.show', ['id' => 1, 'name' => 'john']);

This will generate a URL like /users/1/john.

Note that the parameter names in the route definition must match the keys in the array passed to the route function.

Snapey's avatar

like

<action="{{route('supa', ['id' => $item->id, 'product_id' => $item->product_id ])}}"

but your array keys here need to match the place holder names in your route definition

Please or to participate in this conversation.