public function setStatus($domain, $id, $status) { $str = ''; $user = new User(); if ($user->updateItem($id, array('status' => $status))) { if ($status == 0) { $str = "Đã chuyển sang trạng thái inactive thành công!"; } else { $str = "Đã chuyển sang trạng thái active thành công!"; } } return $str; }
/** * @param $email * @return bool|mixed * @throws \Exception */ public function forgotPassword($email) { $userModel = new User(); $emailService = new mailService(); if (!Validator::make(['email' => $email], ['email' => 'required|email'])) { throw new \Exception('Email is not format'); } $user = $this->getUserByEmail($email); $data = array(); $data['temp_password'] = md5($user->password . time()); $data['temp_password_expire'] = date('Y-m-d H:i:s', strtotime('+1 day')); // expire 1 day $user = $userModel->updateItem($user->id, $data); if ($user) { $emailService->sendEmailForgotPassword($email); return $user; } return false; }