We can pass parameters from uri to routes in laravel like this:
Route::get('/{id?}', function($id) {
return View::make('id', $id);
});
Can we do the same with laravel filters like this:
Route::get('/{id}', array(
'before' => 'idfilter:{id}', function() {
return View::make('home');
}));
The filter for this is:
Route::filter('idfilter', function($route, $request, $id) {
if ($id == 5) {
return 'success'; });
You can do this easily, just get whatever you need from Route::input('*')
.
Route::filter('name', function()
{
if( Route::input('id') == 5 ){
return 'success';
}
}