Reputation: 4808
What is the best way to do and equivalent to CakePHP's beforeFilter() in codeIgniter
Upvotes: 1
Views: 774
Reputation: 17977
sounds like hooks might be what you're after
CakePHP beforeFilter()
This function is executed before every action in the controller. It's a handy place to check for an active session or inspect user permissions.or inspect user permissions.
CodeIgniter pre controller
Called immediately prior to any of your controllers being called. All base classes, routing, and security checks have been done.
$hook['pre_controller'] = array(
'class' => 'MyClass',
'function' => 'Myfunction',
'filename' => 'Myclass.php',
'filepath' => 'hooks',
'params' => array('beer', 'wine', 'snacks')
);
maybe?
Upvotes: 5