Friday, 23 August 2013

Basic laravel Route filter parameters error

Basic laravel Route filter parameters error

I just start learning Laravel today and was reading documentation and
testing example codes etc.
I come up with a basic Route Filter Parameters problem which I'm not sure
how it works.
From an example on this documentation page
http://laravel.com/docs/routing#basic-routing
The code below could be wrong, I am very new to laravel and not sure yet
how it really work
I got code written as which give me ERROR
Route::filter('old', function($age) // a guess is that the correct way to
pass $age=400 ?
{
if($age < 200){
return Redirect::to('');
}
});
Route::get('user', array('before' => 'old:400', function()
{
return 'You are over 200 years old!';
}));
From this codes its mean that its passing a value of "400" to the filter
old right? ... But I don't know how to get that 400 value in the filter...
I mean in which variable that "400" is being passed as or how to retrieve
that "400" value in filter function.
So the question is how to write that filter function to get that "400"
value ?
Thanks in advance :)

No comments:

Post a Comment