I have set my session, however it is not being seen on the other pages.
within the loginController, the login function has:
$session->set('auth', $user->id);
I want when the person log in, it redirects to the index page, but a check needs to be done. However when I tried the below code, it throws an error that session was not defined.
if ($session->has("auth")) {
//Retrieve its value
$name = $session->get("auth");
echo(" ".$name);
exit;
}
I would like when the session is set from the login controller, that the session variable is seen and can be checked is a session was infact set or not. If it is set, show the page. If it was not set, redirect to login.