I want to add some parameters to a filter in Laravel framework.
The catch is, that i am calling my filters from controller's constructor and not route.
My code look like this:
Controller
public function __construct()
{
$this->filter('before','test');
}
Filter
Route::filter('test',function(){
// echo parameters passed to filter in controller.
});
Thanks for your help!
For anyone else, it's quite simple..
Controller
$this->filter('before','test',array('value'));
Filter
Route::filter('test',function($label){
echo $label; // Outputs the 'value'
});