當前位置: 首頁>>代碼示例>>PHP>>正文


PHP User::get方法代碼示例

本文整理匯總了PHP中App\Model\User::get方法的典型用法代碼示例。如果您正苦於以下問題:PHP User::get方法的具體用法?PHP User::get怎麽用?PHP User::get使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在App\Model\User的用法示例。


在下文中一共展示了User::get方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: exist

 private function exist($id)
 {
     $this->row = $this->model->get($id);
     if (!$this->row) {
         $this->flashMessage($this->translator->translate('admin.text.itemNotExist'), 'error');
         $this->redirect('default');
     }
 }
開發者ID:vsek,項目名稱:base,代碼行數:8,代碼來源:UserPresenter.php

示例2: num_active_unactive

 /**
  * 獲取用戶統計信息
  *
  * @param int $flage 默認0,獲取所有用戶;1,獲取已激活用戶;2,獲取未激活用戶;
  *
  * @return mixed
  */
 public function num_active_unactive($flage = 0)
 {
     $users = User::get();
     //已激活用戶
     $active_user = array();
     //未激活用戶
     $unactive_user = array();
     //計數
     $active_num = 0;
     $unactive_num = 0;
     foreach ($users as $k => $kValue) {
         //dump($kValue);
         $email = $kValue->email;
         $credentials0 = ["email" => $email];
         $temp_user_info = Sentinel::findByCredentials($credentials0);
         if (Activation::completed($temp_user_info)) {
             $users[$k]['active'] = 1;
             $active_user[] = $users[$k];
             ++$active_num;
         } else {
             $users[$k]['active'] = 0;
             $unactive_user[] = $users[$k];
             ++$unactive_num;
         }
     }
     if ($flage == 1) {
         $users = $active_user;
     }
     if ($flage == 2) {
         $users = $unactive_user;
     }
     $data['active_num'] = number_format($active_num * 100 / ($active_num + $unactive_num), 2, '.', '');
     $data['unactive_num'] = number_format($unactive_num * 100 / ($active_num + $unactive_num), 2, '.', '');
     return $data;
 }
開發者ID:Chegg-China,項目名稱:Laravel-Admin-Starter,代碼行數:42,代碼來源:Controller.php

示例3: getAll

 function getAll()
 {
     //return User::select('id', 'name')->get();
     return User::get();
 }
開發者ID:quyen91,項目名稱:sifoni-blog-quyenvinhxuan-11-2015,代碼行數:5,代碼來源:User.php

示例4: list_logic

 /**
  * 獲取當前用戶列表
  *
  * @param int $flage 默認0,獲取所有用戶;1,獲取已激活用戶;2,獲取未激活用戶;
  *
  * @return mixed
  */
 public function list_logic($flage = 0)
 {
     $users = User::get();
     $current_user = Sentinel::getUser();
     $current_user_id = $current_user->id;
     //已激活用戶
     $active_user = array();
     //未激活用戶
     $unactive_user = array();
     //計數
     $active_num = 0;
     $unactive_num = 0;
     foreach ($users as $k => $kValue) {
         //dump($kValue);
         $email = $kValue->email;
         $role = $this->role_by_user($kValue);
         //            dump($role);
         if (!$role) {
             $users[$k]['role'] = null;
         } else {
             $users[$k]['role'] = $role->slug;
         }
         $credentials0 = ["email" => $email];
         $temp_user_info = Sentinel::findByCredentials($credentials0);
         if (Activation::completed($temp_user_info)) {
             $users[$k]['active'] = 1;
             $active_user[] = $users[$k];
             ++$active_num;
             //當前賬號
             if ($current_user_id == $temp_user_info['id']) {
                 $users[$k]['active'] = 2;
             }
         } else {
             $users[$k]['active'] = 0;
             $unactive_user[] = $users[$k];
             ++$unactive_num;
         }
     }
     if ($flage == 1) {
         $users = $active_user;
     }
     if ($flage == 2) {
         $users = $unactive_user;
     }
     return $users;
 }
開發者ID:Chegg-China,項目名稱:Laravel-Admin-Starter,代碼行數:53,代碼來源:AccountController.php


注:本文中的App\Model\User::get方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。