returning redirect from parent's function. - 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: returning redirect from parent's function. (/showthread.php?tid=76305) |
returning redirect from parent's function. - s4if - 05-01-2020 Hi, I want to make simple authentication checking method in BaseController.php so it can be accessed by another controller like this: PHP Code: protected function mustLoggedIn() PHP Code: public function beranda() How to implement login check like that in CI4? RE: returning redirect from parent's function. - vincent78 - 05-02-2020 Hello, The 'exit()' call after the 'return' will never be executed. PHP Code: protected function isLoggedIn() PHP Code: public function beranda() Vincent RE: returning redirect from parent's function. - kilishan - 05-03-2020 I think you might want to check out Controller Filters. They are designed to handle exactly that type of situation. |