Nearly. Really you want to be doing this:
Route::get('hello/{num}', function($id)
{
return 'yey ' . $id;
});
Domanda
I'm having a little bit of trouble getting a Laravel 4 route working - just couldn't get my head around it what I'm doing wrong.
My composer packages are up-to-date and I'm using the latest version of illuminate/app.
Here's a route which works fine:
GET /hello
Route::get('hello', function()
{
return 'yey';
});
But I just can't get a second uri segment to pass as a param.
This didn't work:
GET /hello/1
Route::get('hello/(:num)', function($id)
{
return 'yey ' . $id;
});
Or:
GET /hello/1
Route::get('hello/(:any)', function($id)
{
return 'yey ' . $id;
});
Ultimately I want a controller to handle my stuff - but I just don't know what I'm doing wrong at the moment.
Soluzione
Nearly. Really you want to be doing this:
Route::get('hello/{num}', function($id)
{
return 'yey ' . $id;
});