本文整理匯總了PHP中RainLab\User\Models\User::attemptActivation方法的典型用法代碼示例。如果您正苦於以下問題:PHP User::attemptActivation方法的具體用法?PHP User::attemptActivation怎麽用?PHP User::attemptActivation使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類RainLab\User\Models\User
的用法示例。
在下文中一共展示了User::attemptActivation方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: importData
public function importData($results, $sessionKey = null)
{
foreach ($results as $row => $data) {
$data += ['is_activated' => true];
if (empty($data['username'])) {
$data['username'] = $data['email'];
}
if (empty($data['password'])) {
$data['password'] = $data['username'];
}
if (empty($data['password_confirmation'])) {
$data['password_confirmation'] = $data['password'];
}
try {
$user = new User();
$user->fill($data);
// try to find avatar
$avatar = $this->findAvatar($data['username']);
if ($avatar) {
$user->avatar = $avatar;
}
// save user
$user->save();
// activate user
$user->attemptActivation($user->activation_code);
$this->logCreated();
} catch (\Exception $ex) {
$this->logError($row, $ex->getMessage());
}
}
}