Welcome Guest, Not a member yet? Register   Sign In
problem with custom controller constructor

(05-29-2021, 12:25 PM)includebeer Wrote: Don't use a constructor. Override initController(), don't forget to call parent::initController(), and then do what you need to do.
But, a better approach, would be to create a filter and do your redirect in it.

Is this the CI4 Way to use a constructor? I had the problem to access the request object in the constructor and got another solution here in the forum. You can call the request class with a service in the __construct method. I don't know if there are problems if the request class is called again in the initController method.

Messages In This Thread
RE: problem with custom controller constructor - by groovebird - 06-22-2022, 12:54 PM

Theme © iAndrew 2016 - Forum software by © MyBB