Support the ongoing development of Laravel.io →
Security Requests
Last updated 3 months ago.
0

You can access route parameters within your filter via first closure's parameter ($route).

In your case this code would probably do what you want:

Route::any('/{id}', array(
    'before' => 'auth|ownWed', // we don't pass $id here
    'as' => 'wedding',
    'uses' => '[email protected]'
))->where('id', '[0-9]+');

Route::filter('ownWed', function($route) {
    // the $route variable passed to this closure contains
    // current route object which has all the info you want
    echo 'id parameter in route = ' . $route->getParameter('id');
});
Last updated 3 months ago.
0

Sign in to participate in this thread!

LoadForge

Your banner here too?

tzookb tzookb tzookb Joined 9 Feb 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

The Laravel portal for problem solving, knowledge sharing and community building.

© 2022 Laravel.io - All rights reserved.