Welcome Guest, Not a member yet? Register   Sign In
How to use return redirect() in helper or BaseController

redirect() method is working perfectly on the controller but when trying to use it in helper or BaseController, it's not accepting returns.
I tried this code but didn't work on both helper and BaseController
PHP Code:
$session = \Config\Services::session();
$user_data $session->get(); 
PHP Code:
if(!($user_data['user']['user_type'] == && $user_data['user']['is_active'] == && $user_data['user']['isLoggedIn'] == 1)){            
// return redirect()->to('admin'); 
    // header("Location: admin");
    // die;
    // $this->response->setHeader('Location', site_url('admin'));
    // return redirect()->to(site_url());
    return redirect()->route('admin');

How to access it or is it possible or not??? 

All you need to know is you must return RedirectResponse object from the controller.
redirect() returns RedirectResponse object.

Theme © iAndrew 2016 - Forum software by © MyBB