本文整理汇总了PHP中Model_Users::add方法的典型用法代码示例。如果您正苦于以下问题:PHP Model_Users::add方法的具体用法?PHP Model_Users::add怎么用?PHP Model_Users::add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Model_Users
的用法示例。
在下文中一共展示了Model_Users::add方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: post
public function post()
{
$userLevel = (int) $this->getRequest()->getParam('user-level', false);
$firstName = $this->getRequest()->getParam('first-name', false);
$lastName = $this->getRequest()->getParam('last-name', false);
$email = $this->getRequest()->getParam('email', false);
$password = $this->getRequest()->getParam('password', false);
if (!$firstName || !$lastName || !$email || !$password) {
$this->getResponse()->setBody(array('status' => 'failed', 'message' => 'Required parameters: user-level,first-name,last-name,email,password'));
return;
}
$uuid = $this->users->add($firstName, $lastName, $email, $password, $userLevel);
$this->getResponse()->setBody(array('status' => 'success', 'id' => $uuid));
}
示例2: post_index
public function post_index($username, $email, $id_group)
{
$checkExisting = Model_Users::createRequest()->where('username = ? OR email = ?', [$username, $email])->exec();
if (!$checkExisting->isEmpty()) {
$this->response->error('Un utilisateur avec ce pseudo ou cette adresse existe déjà.', 403);
return;
}
$password = Library_String::generatePassword();
$group = Model_Groups::getById($id_group);
Model_Users::add(new Model_Users($username, $email, $password, $group));
$email_content = \Eliya\Tpl::get('emails/register', ['username' => $username, 'email' => $email, 'password' => $password, 'login_url' => BASE_URL . 'admin/login']);
Library_Email::send($email, 'Bienvenue sur Le Chomp Enchaîné !', $email_content);
$this->get_index();
}