当前位置: 首页>>代码示例>>PHP>>正文


PHP Users::select方法代码示例

本文整理汇总了PHP中app\models\Users::select方法的典型用法代码示例。如果您正苦于以下问题:PHP Users::select方法的具体用法?PHP Users::select怎么用?PHP Users::select使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在app\models\Users的用法示例。


在下文中一共展示了Users::select方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: saveAction

 public function saveAction()
 {
     if (!$this->isXmlHttpRequest()) {
         throw new \Exception('Неверный тип запроса!');
     }
     $usersModel = new Users();
     $data = $this->request->getPost();
     if (!isset($data['id']) || !isset($data['roles_id']) || !isset($data['user']) || !isset($data['password'])) {
         throw new \Exception('Неверный тип запроса!');
     }
     if ($data['action'] == 'add' && (!isset($data['lastname']) || !isset($data['firstname']) || !isset($data['secondname']) || !isset($data['org_name']))) {
         throw new \Exception('Неверный тип запроса!');
     }
     $data['id'] = (int) $data['id'];
     if (!$data['id'] && $data['action'] != 'add') {
         throw new \Exception('Неверный идентификатор пользователя!');
     }
     $data['roles_id'] = (int) $data['roles_id'];
     if ($data['roles_id'] == 0) {
         throw new \Exception('Не выбраны права пользователя!');
     }
     $data['user'] = trim($data['user']);
     if ($data['user'] == '') {
         throw new \Exception('Не заполнено обязательное поле Email!');
     }
     $data['password'] = trim($data['password']);
     if ($data['password'] == '' && $data['action'] != 'add') {
         unset($data['password']);
     }
     if (isset($data['password']) && mb_strlen($data['password']) < 6) {
         throw new \Exception('Пароль должен быть больше 6 символов!');
     }
     if ($data['action'] == 'add') {
         $data['lastname'] = trim($data['lastname']);
         if ($data['lastname'] == '') {
             throw new \Exception('Не заполнено обязательное поле Фамилия!');
         }
         $data['firstname'] = trim($data['firstname']);
         if ($data['firstname'] == '') {
             throw new \Exception('Не заполнено обязательное поле Имя!');
         }
         $data['secondname'] = trim($data['secondname']);
         if ($data['secondname'] == '') {
             throw new \Exception('Не заполнено обязательное поле Отчество!');
         }
         $data['org_name'] = trim($data['org_name']);
         if ($data['org_name'] == '') {
             throw new \Exception('Не заполнено обязательное поле Организация!');
         }
     }
     unset($data['action']);
     $data['id'] = $usersModel->save($data);
     $usersModel->setWhere(array('id' => $data['id']));
     $uData = $usersModel->select();
     $this->view->data = $uData[0];
     $rolesModel = new Roles();
     $this->view->roles = $rolesModel->select();
 }
开发者ID:BoesesGenie,项目名称:team-rex,代码行数:58,代码来源:UsersController.php

示例2: getformAction

 public function getformAction()
 {
     if (!$this->isXmlHttpRequest()) {
         throw new \Exception('Неверный тип запроса!');
     }
     $project = false;
     if (!is_null($this->request->getPost('id'))) {
         $id = (int) $this->request->getPost('id');
         $projectsModel = new Projects();
         $project = $projectsModel->getProjectsDataForEdit($id);
         $usersModel = new Users();
         $usersModel->setWhere('`roles_id` IN(1,2)');
         $this->view->initiators = $usersModel->select();
         $usersModel->setWhere('`roles_id` IN(1,3)');
         $this->view->executors = $usersModel->select();
         $executorsModel = new Executors();
         $this->view->selectedExecutors = $executorsModel->getExecutorsAsArrayByProject($id);
         $statusModel = new Status();
         $this->view->statuses = $statusModel->select();
     }
     $this->view->project = $project;
 }
开发者ID:BoesesGenie,项目名称:team-rex,代码行数:22,代码来源:ProjectsController.php

示例3: checkUser

 private function checkUser($id, $name)
 {
     Users::redirectIf(false);
     $users = Users::select()->where('id', $id)->andWhere('nickname', $name)->orWhere('user_key', $name)->get(0, 1);
     if (empty($users)) {
         Router::redirect('error.error404');
     }
     $user = $users[0];
     if (!Users::canUpdate($user)) {
         Router::redirect('home.index');
     }
     return $user;
 }
开发者ID:quenti77,项目名称:easyhq,代码行数:13,代码来源:DetailsController.php

示例4: show

 public function show($id)
 {
     $cacheTag = ['users'];
     $cacheKey = $id;
     $response = Cache::tags($cacheTag)->remember($cacheKey, 60 * 24 * 7, function () use($id) {
         $_model = Users::select(['name', 'lastname', 'email', 'active', 'confirmed', 'avatar', 'created_at', 'updated_at'])->where('company_id', config('global.companies.current.id'))->where('id', $id);
         if ($_model->count() > 0) {
             return $_model->first()->toArray();
         } else {
             return false;
         }
     });
     if (!$response) {
         Cache::tags($cacheTag)->forget($cacheKey);
         return new \Exception("Houve um erro ao localizar registro (id not found)");
     }
     return $response;
 }
开发者ID:PingadoWeb,项目名称:deliveryApi,代码行数:18,代码来源:UsersRepository.php

示例5: users

 public function users()
 {
     $count = Users::select(\DB::raw('count(id) as total'))->where('company_id', config('global.companies.current.id'))->count();
     return $this->jsonResponse(['data' => $count]);
 }
开发者ID:PingadoWeb,项目名称:deliveryApi,代码行数:5,代码来源:IndexController.php

示例6: resend

 public function resend($id)
 {
     $this->checker('update_full_admin');
     $user = Users::select()->where('id', $id)->get();
     if (empty($user)) {
         Router::redirect('home.index');
     }
     $user = $user[0];
     $user->mail_check = sha1($user->user_key . '-----' . time());
     $user->mail_check_at = BaseModel::now();
     $user->save();
     Users::sendMailCheck($user);
     Router::redirect('admin:user.show');
 }
开发者ID:quenti77,项目名称:easyhq,代码行数:14,代码来源:UserController.php

示例7: findUser

 protected function findUser($email)
 {
     return \App\Models\Users::select('id', 'email', 'active')->whereEmail($email)->first();
 }
开发者ID:Abdulhmid,项目名称:imageup,代码行数:4,代码来源:HomeController.php

示例8: getForContact

 private function getForContact($page = 1)
 {
     if (!Session::exists('member')) {
         Router::redirect('home.index');
     }
     $nb = self::NUMBER_ITEM_PER_PAGE;
     $member = Session::get('member');
     $member = $this->checkUser($member['id'], $member['nickname']);
     $search = Helper::post('research');
     $all_contact = UsersBook::select()->where('id_user_from', $member->id)->orWhere('id_user_to', $member->id)->get();
     $list = [$member->id];
     foreach ($all_contact as $contact) {
         if ($contact->id_user_from == $member->id) {
             $list[] = $contact->id_user_to;
         } else {
             $list[] = $contact->id_user_from;
         }
     }
     $users = Users::select()->addFields(['users.id' => 'user_id', 'users.nickname' => 'user_nickname', 'users.mail' => 'user_mail'])->where('users.mail_check', '1')->andWhere('users.id', 'NOT IN', $list)->andGroup([new Condition('WHERE', '', 'users.nickname', 'LIKE', '%' . $search . '%', false), new Condition('WHERE', 'OR', 'users.mail', 'LIKE', '%' . $search . '%', false)])->get(($page - 1) * $nb, $nb);
     $count = Users::select()->addFields(['COUNT(*)' => 'nb_user'])->where('users.mail_check', '1')->andWhere('users.id', 'NOT IN', $list)->andGroup([new Condition('WHERE', '', 'users.nickname', 'LIKE', '%' . $search . '%', false), new Condition('WHERE', 'OR', 'users.mail', 'LIKE', '%' . $search . '%', false)])->get(0, 1);
     $max_page = 0;
     if (!empty($count)) {
         $count = $count[0];
         $max_page = ceil($count->nb_user / $nb);
     }
     if ($max_page == 0) {
         $max_page = 1;
     }
     $this->set('max_page', $max_page);
     $this->set('users', $users);
     $this->set('member', $member);
     $this->render('user/search');
 }
开发者ID:quenti77,项目名称:easyhq,代码行数:33,代码来源:BookController.php

示例9: verify

 public function verify($key)
 {
     //Users::redirectIf(true);
     $users = Users::select()->where('mail_check', $key)->andWhere('TIMESTAMPDIFF(MINUTE, mail_check_at, NOW())', '<', 30, false)->get();
     if (!empty($users)) {
         $user = $users[0];
         $user->mail_check = '1';
         $user->save();
     }
     $users = Users::select()->where('mail_check', '!=', '1')->andWhere('TIMESTAMPDIFF(MINUTE, mail_check_at, NOW())', '>', 35, false)->get();
     foreach ($users as $user) {
         $user->delete();
     }
     Session::setFlash('success', '', Translate::get('user.success.register_mail'));
     Router::redirect('home.index');
 }
开发者ID:quenti77,项目名称:easyhq,代码行数:16,代码来源:AccountController.php

示例10: ProgressCustomer

 /**
  * This function loads the 'Events  Progress'  page for Customer
  *
  *
  * @return  progress 'Events Progress' page with Event Tasks/Quote Requests table data
  */
 public function ProgressCustomer()
 {
     $input = Request::all();
     $iName = $input['EventID'];
     $user_id = \Auth::user()->id;
     //$customereventid = Quote_Requests::select('*')->where('id',$iName)->first();
     $memtasks = Event_Tasks::select('*')->where('EventID', $iName)->get();
     $teammem = Users::select('*')->where('role', 'team-member')->get();
     $evedetails = Quote_Requests::select('*')->where('id', $iName)->first();
     $data = array('memtasks' => $memtasks, 'teammem' => $teammem, 'eveID' => $iName, 'evedetails' => $evedetails, 'result' => 'null');
     return view('progress_customer.progress')->with($data);
 }
开发者ID:gayankalhara,项目名称:planmyevent,代码行数:18,代码来源:ProgressControllerU.php

示例11: register

 public function register()
 {
     Users::redirectIf(true);
     $nickname = Helper::post('nickname');
     $password = Helper::post('password');
     $confirm = Helper::post('password_confirm');
     $email = Helper::post('email');
     if (empty($nickname) || empty($password) || empty($confirm) || empty($email)) {
         Session::setFlash('danger', '', Translate::get('error.forms.missing.content'));
         Router::redirect('user.signup');
     }
     $errors = [];
     if (strlen($nickname) < 3 || strlen($nickname) > 40) {
         $errors['username'] = Translate::get('register.error.username');
     }
     if (!preg_match('#[a-zA-Z0-9\\_\\.]+#', $nickname)) {
         $errors['username'] = Translate::get('register.error.username');
     }
     if (strlen($password) < 6) {
         $errors['password'] = Translate::get('register.error.password');
     }
     if ($password != $confirm) {
         $errors['password'] = Translate::get('register.error.password_confirm');
     }
     if (!preg_match('/[a-zA-Z0-9\\_\\-\\.]{3,}@[a-zA-Z0-9\\-]{2,}\\.[a-z]{2,6}/', $email)) {
         $errors['email'] = Translate::get('register.error.email');
     }
     if (!empty($errors)) {
         ob_start();
         Translate::getContent('error_fields', ['errors' => $errors]);
         $content = ob_get_clean();
         Session::setFlash('danger', '', $content);
         Router::redirect('user.signup');
     }
     $users = Users::select()->addFields(['id'])->where('nickname', $nickname)->andWhere('mail', $email)->get(0, 1);
     if (!empty($users)) {
         Session::setFlash('danger', '', Translate::get('user.error.register'));
         Router::redirect('user.signup');
     }
     $random = '';
     while ($random == '') {
         $random = Config::randomString(14);
         if (Users::find('user_key', $random)) {
             $random = '';
         }
     }
     $default_group = Groups::find('g_default', 1);
     $user = Users::create();
     $user->id_group = $default_group->id;
     // TODO: Change for default group
     $user->nickname = $nickname;
     $user->password = password_hash($password, PASSWORD_BCRYPT);
     $user->user_key = $random;
     $user->mail = $email;
     $user->mail_check = sha1($user->user_key);
     $user->mail_check_at = BaseModel::now();
     $user->register_at = BaseModel::now();
     $user->connection_at = '0000-00-00 00:00:00';
     $user->save();
     Users::sendMailCheck($user);
     Session::setFlash('success', '', Translate::get('user.success.register'));
     Router::redirect('home.index');
 }
开发者ID:quenti77,项目名称:easyhq,代码行数:63,代码来源:UserController.php

示例12: initialRegistration

 public function initialRegistration(Request $request)
 {
     $user = new Users();
     $user->email = $request->input('email');
     $user->user_name = $request->input('username');
     $user->password = $request->input('password');
     $user->first_name = $request->input('first_name');
     $user->last_name = $request->input('last_name');
     $referralId = $request->session()->get('referralId');
     $ecosponsor = $request->cookie('ecosponsor');
     if ($referralId == '') {
         $referralId = $ecosponsor;
     }
     if ($referralId < 1) {
         $refUser = Users::select('id')->where('member', 5)->orderByRaw("RAND()")->first();
         $referralId = $refUser->id;
     }
     $referrer = Users::find($referralId);
     $request->session()->set('referralId', '');
     $user->sponsor_id = $referrer->id;
     $user->second_id = $referrer->sponsor_id;
     $user->third_id = $referrer->second_id;
     $user->fourth_id = $referrer->third_id;
     $user->fifth_id = $referrer->fourth_id;
     $user->member = 1;
     $user->save();
     $user->user_link = md5($user->id);
     $user->save();
     $request->session()->set('user_id', $user->id);
     $request->session()->set('username', $user->first_name . ' ' . $user->last_name);
     return $user;
 }
开发者ID:eco-nomix,项目名称:deployed,代码行数:32,代码来源:AuthenticationController.php

示例13: findUser

 protected function findUser($username)
 {
     return \App\Models\Users::select('*')->whereEmail($username)->orWhere('username', $username);
 }
开发者ID:Abdulhmid,项目名称:wecando,代码行数:4,代码来源:FrontendController.php

示例14: savestatusAction

 public function savestatusAction()
 {
     if (!$this->isXmlHttpRequest()) {
         throw new \Exception('Неверный тип запроса!');
     }
     $data = $this->request->getPost();
     if (!isset($data['id']) || !isset($data['task_status_id'])) {
         throw new \Exception('Неверный тип запроса!');
     }
     $data['id'] = (int) $data['id'];
     $data['task_status_id'] = (int) $data['task_status_id'];
     $tasksModel = new Tasks();
     $tasksModel->save($data);
     $timelineModel = new Timeline();
     $timelineModel->endWork($data['id']);
     $task = $tasksModel->getTasksDataById((int) $data['id']);
     $to = array();
     $usersModel = new Users();
     $usersModel->setWhere(array('id' => 1));
     $result1 = $usersModel->select();
     $to[] = $result1[0]['user'];
     $usersModel->setWhere(array('id' => (int) $task['executors_id']));
     $result2 = $usersModel->select();
     if ($result2 && $result2[0]['user'] != $result1[0]['user']) {
         $to[] = $result2[0]['user'];
     }
     $usersModel->setWhere(array('id' => (int) $task['initiator']));
     $result3 = $usersModel->select();
     $to[] = $result3[0]['user'];
     $subject = 'Изменение статуса задачи';
     $message = 'По задаче "' . $task['name'];
     $message .= '" сменился статус на ' . $task['ts_name'] . "\n";
     $message .= 'По проекту: ' . ($task['p_name'] ? $task['p_name'] : 'Без проекта');
     Mail::instance()->send($to, $subject, $message);
 }
开发者ID:BoesesGenie,项目名称:team-rex,代码行数:35,代码来源:TasksController.php

示例15: getUserState

 /**
  * @param int $id
  * @return bool
  */
 public function getUserState($id)
 {
     $userState = Users::select("Active")->where("uid", "=", $id)->get()->first();
     if ($userState == null) {
         return false;
     }
     if (!$userState->Active) {
         return false;
     }
     return true;
 }
开发者ID:nickterekhin,项目名称:sj2,代码行数:15,代码来源:UsersModelImpl.php


注:本文中的app\models\Users::select方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。