Can not declare session check in contractor in ci4 - 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: Can not declare session check in contractor in ci4 (/showthread.php?tid=75941) |
Can not declare session check in contractor in ci4 - seunex - 03-30-2020 I was trying to protect full controller class from non authorize user so I use PHP Code: if(! session()->has('isLogged')) Buh will not work untill I put that same code in each method before it effect. Any way to make it for the whole controller? RE: Can not declare session check in contractor in ci4 - maxxd - 03-31-2020 Sounds like you're looking for a before filter - https://codeigniter4.github.io/userguide/incoming/filters.html RE: Can not declare session check in contractor in ci4 - seunex - 03-31-2020 (03-31-2020, 04:25 AM)maxxd Wrote: Sounds like you're looking for a before filter - https://codeigniter4.github.io/userguide/incoming/filters.html That save my day. A big Thank you. |