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.
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
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');
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);
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community