Welcome Guest, Not a member yet? Register   Sign In
Can not declare session check in contractor in ci4
#1

I was trying to protect full controller class from non authorize user so I use

PHP Code:
if(! session()->has('isLogged'))
{
return 
redirect()-route('loginPage');


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?
Reply
#2

Sounds like you're looking for a before filter - https://codeigniter4.github.io/userguide...lters.html
Reply
#3

(03-31-2020, 04:25 AM)maxxd Wrote: Sounds like you're looking for a before filter - https://codeigniter4.github.io/userguide...lters.html


That save my day. A big Thank you.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB