How to 'protect' Controller? |
Hi,
I'm taking serious baby steps here ... none of my 'knowledge' from CI3 seem to apply anywhere in CI4 (I know it's a complete rewrite). I've created an AdminController which extends the BaseController. In that AdminController I've added a __construct: Code: protected $helpers = ['url']; I'm having another controller extends this ... but I simply cannot get my head around WHY it's not redirecting as 'expected'? What is it that I'm completely missing about CI4 despite having read the docs over and over and over and over again and again and again?
Did you have a chance to check the "redirect" part in the documentation? You should type as , for example,
PHP Code: // Go to specific UI Documentation About Redirect
Yes, I've tried ALL sorts of ways I ran into in my search ... I only ended up with this as I struggled my way through the jungle of questions and 'answers' in my online search, as the docs wasn't any help. A pure trial and error scenario ... which, to be honest, isn't a way to develop ANYTHING. It simply surprises me that basic stuff like this is that 'hard' to figure out.
If I slam the above directly into an index method of a Controller it works just fine ... just not when I place it in the __construct of the inherited controller ... I don't get it?
Allright, following your problem (redirect problem in __construct) I have found this :
CI Forum Link
Yes, I just found that as well, thanks.
Tip for old users: Don't apply ANY of the things you used to in CI3 to CI4 – start over. Warning: even though I'm trying to do that, I do get pretty confused from 'just reading the docs' … |
Welcome Guest, Not a member yet? Register Sign In |