Laravel:将路由参数传递给filter参数

I have this route (note the filter which is being applied with an optional parameter):

Route::get('/greet/{name?}', array(
    'before'    => 'summergreet:optionalNameToCapture',
    function ($name = 'friend') {
        return View::make('greetview', array('name' => $name));
    }
));

And the assigned filter:

Route::filter('summergreet', function($route, $request, $name = 'amigo')
{
    if (date('m') >= 7 && date('m') <= 9) {
        return View::make('summergreetview', array('name' => $name));
    }
});

How can I capture the optional parameter to the route and pass it through to the filter?

You can do

Route::filter('summergreet', function($route, $request, $name = 'amigo')
{
    $name = $route->parameter('name');
    if (date('m') >= 7 && date('m') <= 9) {
        return View::make('summergreetview', array('name' => $name));
    }
});

I'm not sure how it works for 'optional' parameters. You might need to check isset() or is_null on the variable first....