Support the ongoing development of Laravel.io →
Configuration Requests
Last updated 2 years ago.
0

I think the only way to do this is using a closure in your route. Written on mobile, not tested but it should work.

Route::get($known_route, function() use ($id) {
    return App::make('SomeController')->someMethod($id);
}); 

It isn't clean, but it should work.

0

I'm not sure if I understand what you mean, but you have where() method for routes:

Route::get('{slug}', 'SomeController@someMethod')->where('slug', 'value1|value2|value3');

Source: http://laravel.com/docs/4.2/routing#route-parameters

0

What is the parameter you need to pass? It will be in the URL? If yes, this is probably what you want:

Route::get('{slug}/{id}', 'SomeController@someMethod')->where('slug', 'value1|value2|value3');
0

Thanks mengidd, that's exactly what I was after. The only thing I had to do was include the namespace of the controller within the closure:

return App::make('App\Http\Controllers\SomeController')->someMethod($id);
0

Sign in to participate in this thread!

Eventy

Your banner here too?

carbsrule carbsrule Joined 28 Jan 2015

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.

© 2024 Laravel.io - All rights reserved.