Pass data to filter |
Hello, tell me please can i pass some data (from controller) to filter before?
For example i have some data in controller like name, type, acceess and i need it pass to filter, to undestand this user can access to page or not. I can do it in constructor, but its not correct way, how decide this problem? or use after event?
Filter::before() are fired before the controller is initialized.
You in principle will not be able to get any data from the controller.
// Get Name of controller
$router = service('router'); $controller = $router->controllerName(); // Load Contoller $controller = new $controller; var_dump(controller->data); |
Welcome Guest, Not a member yet? Register Sign In |