Hi guys, What I want to do is if anyone accesses /admin/ and does not have the session variable to get redirected to homepage ("/" route) .
What I want to do, is make a general check in the AdminController only once :
public function onConstruct()
{
if (is_null($this->session->get('auth-identity'))) {
header('Location: /');
return;
}
}
And this works fine, but I don`t like this method - I would like to use the response object and redirect, but when trying with $response->redirect('/'); , when accessing '/admin/' - my index controller response is returned with no redirect.
Can you please guide me here?