Here is my code …
$clockInSignInForm = new ClockInSignInForm;
if($clockInSignInForm->load(Yii::$app->request->post()) && $clockInSignInForm->validate()) {
Yii::$app->user->logout();
$property = Property::find()->andwhere(["clockInUsername" => $clockInSignInForm->username])->one();
Yii::$app->user->login($property);
return $this->redirect(["clock-in/"]);
}
$clockInSignInForm->password = null;
return $this->render("create", [
"models" => [
"clockInSignInForm" => $clockInSignInForm
]
]);
If I echo out the Yii::$app->user->id after login it works, but on the page after if I echo it, it does not work.
I have tried echoing session data before and after however it echoes before redirect but not after.
The code use to work so I do not know why it would not be working now. I have tried clearing browser cache and still not working.
The page after redirect is literally just an action with the echo in it and that is it.