Input::get('age') will look for a variable named as 'age' in query string :
e.g, user/?age=220
But, you can access route parameters using first parameter of filter closure i.e, '$route':
//filters.php
Route::filter('old', function($route)
{
if($route->getParameter('age') < 200 )
{
return 'Age is:'. $route->getParameter('age');
}
});
//routes.php
Route::get('user/{age}', array('before' => 'old', function()
{
return 'You are over 200 years old!';
}));
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community