php - Basic laravel Route filter parameters error -


i start learning laravel today , reading documentation , testing example codes etc.

i come basic route filter parameters problem i'm not sure how works.

from example on documentation page http://laravel.com/docs/routing#basic-routing

the code below wrong, new laravel , not sure yet how work

i got code written give me error

route::filter('old', function($age)  // guess correct way pass $age=400 ? {    if($age < 200){      return redirect::to('');     } });  route::get('user', array('before' => 'old:400', function() {     return 'you on 200 years old!'; })); 

from codes mean passing value of "400" filter old right? ... don't know how 400 value in filter... mean in variable "400" being passed or how retrieve "400" value in filter function.

so question how write filter function "400" value ?

thanks in advance :)

if want pass parameter or value evaluated filter must this:

route::filter('age', function($route, $request, $value) {   if($value < 200)   return redirect::to('/'); });  route::get('test', array('before' => 'age:199', function() {   return 'hello world'; })); 

i followed same example in documentation , worked.


Comments

Popular posts from this blog

java - Run a .jar on Heroku -

java - Jtable duplicate Rows -

validation - How to pass paramaters like unix into windows batch file -