![]() |
How to access controller property inside a filter? - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28) +--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30) +--- Thread: How to access controller property inside a filter? (/showthread.php?tid=76143) |
How to access controller property inside a filter? - emaidana - 04-16-2020 Hello, Is possible to access a controller property like $this->checkUser inside a before Filter? I need to perform some additional actions depending on the called controller's property value set on __contruct() method. Regards. RE: How to access controller property inside a filter? - kilishan - 04-16-2020 The controller is not available from the filters, just the Request and Response objects. RE: How to access controller property inside a filter? - emaidana - 04-16-2020 (04-16-2020, 10:59 AM)kilishan Wrote: The controller is not available from the filters, just the Request and Response objects. Thanks for the reply. Do you have another idea about how to check user credentials (not only if is logged in) according to specific controller called? Regards. RE: How to access controller property inside a filter? - Gary - 04-16-2020 I've done something that sounds vaguely similar to what you're wanting to do (this one keeps a log (using another model 'controller') to flag users who are possibly up to no good) using the CI Throttle filter: Code: class Throttle implements FilterInterface ... not sure if this helps? |