Support the ongoing development of Laravel.io →
Configuration Requests Input

Hello guys,

I have this Route defitinion:

Route::get('packages/{package}', ['uses' => 'ProductsController@package', 'as' => 'products.packages']);

And now I need different URL which will use same controller with exact {package} defined.

Something like this:

Route::get('/some/path', ['uses' => 'ProductsController@package', 'package' => 'PACK_ID']);

How can I pass PACK_ID to controller without defining it in URL.

I know I can just call another controller method, which will call package method ($this->package($PACK_ID)), but i'm trying to do this in the shortest path.

BTW, sorry for my english.

Last updated 3 years ago.
0

You'd need to perhaps store it in the session or somewhere outside of the route, you won't be able to pass it directly into the controller method from a route.

Last updated 3 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

kticka kticka Joined 7 Aug 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.