I would like to know how to call a method of a component that I created in CakePHP 3 on all controllers, as well as Auth that checks whether the user is logged in or not on all controllers. However I also want to be able to call another method of this my component on some controllers in beforeFilter
before it executes the default method that will always be executed.
Example:
In some controllers in beforeFilter
I allow some actions of it with $this->Auth->allow('add')
and so when AuthComponent will check whether the User is logged in or not he ignores because the page was set as allowed, I need to do basically the same with the component I created.
I want to perform a certain default action on all controllers, but I can set some settings on the beforeFilter
of any controller before the default action is performed.