check your $request
in the filter
I believe
$request->get('id');
should give you the id
your before
should look like
....
'before' => 'maxId',
....
Hi zenry,
these calls work:
$route->getParameter('id')
Route::input('id')
As long as
$request->get('id')
return null.
But I would like to know if there a way to pass an argument directly within the filter, since the filter method accept a third parameter....
Surely there must be a way....
class MaxIdFilter {
public function filter( $route , $request ) {
if ($route->getParameter('id') > 200) {
return Redirect::route('home', array('error' => 'maxid'));
}
}
}
what I would like to do, is use the route for "send" the parameter at the filter through use of this syntax:
Route::get('/{id}', array(
'as' => 'idhandler',
'before' => 'maxId:HERE_ID_PARAMETER',
'uses' => 'IdController@showDataId'
));
instead, the examples shown so far, take the parameter directly in the filter class through method calls:
$route->getParameter('id')
Route::input('id')
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community