Welcome Guest, Not a member yet? Register   Sign In
Redirect in initController
#1

I want to redirect to another controller from initController based on some conditions but ci4 is not redirecting and directly accessing the index method.

can anyone help me with that why ci4 not redirecting while in ci3 we can redirect from constructor.

for example : 

public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger) {
        parent::initController($request, $response, $logger);
         if($this->data['menu_key']  == ''){
            return redirect()->to('Dashboard');
        }
}
Reply


Messages In This Thread
Redirect in initController - by Aarzu - 10-11-2022, 08:29 AM
RE: Redirect in initController - by ozornick - 10-11-2022, 10:37 AM
RE: Redirect in initController - by kenjis - 10-11-2022, 05:18 PM



Theme © iAndrew 2016 - Forum software by © MyBB