I was updating the user details using save()
. And, i followed the guide of yii framework i.e. Yii2-Guide-Save()
$customer = Customer::findOne(123);
$customer->email = 'james@newexample.com';
$customer->save();
But, it's not updating any value. I'm not getting what is the problem.
When, i'm doing var_dump($users->save());
It's displaying bool(false).
$confirmLinkID;
value coming.
Here is my controller.
public function actionResend()
{
$model=new Users(); // User Model
if ($model->load(Yii::$app->request->post())) {
$post = Yii::$app->request->post('Users');
$userDetails = $model->findOne(['email' => $post['email']]);
// If Account Is Already Activated
if($userDetails['status'] == 1) {
Yii::$app->session->setFlash('AccountAlreadyVerified');
return $this->refresh();
}
// If status == 2
if($userDetails) {
$confirmLinkID=$model->getAuthKey();
$users = Users::findOne(['email' => $post['email']]);
$users->auth_key = $confirmLinkID;
$users->save();
}
}
}
Please help.