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


PHP User::whereRaw方法代碼示例

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


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

示例1: bellyButton

 public function bellyButton()
 {
     $users = User::whereRaw('MONTH(birthday) =' . date('m'))->whereRaw('DAY(birthday) =' . date('d'))->where('membership_expires', '>=', date('Y-m-d'))->get();
     $data = array();
     foreach ($users as $user) {
         $data[] = array('recipient' => $user->email, 'first_name' => $user->first_name);
     }
     $this->cron->sendBellyButtonBirthdayCards($data);
     return view('cron.belly-button-birthdays', array('users' => $users));
 }
開發者ID:scotthummel,項目名稱:lambdaphx,代碼行數:10,代碼來源:CronController.php

示例2: anyLogin

 public function anyLogin()
 {
     $all = request()->all();
     if (isset($all['name']) && isset($all['psw'])) {
         $user = User::whereRaw('name = ?', [$all['name']])->first();
         if (isset($user) && $user->psw == $all['psw']) {
             session(['currentUser' => $user]);
             return redirect()->action('Bupt\\UserController@anyIndex');
         }
     }
     return view('bupt.user.login', request()->all());
 }
開發者ID:xiaocailj,項目名稱:laravel-v5.1.11,代碼行數:12,代碼來源:UserController.php

示例3: getFightersFor

 public function getFightersFor($gender, $age_group, $belt, $weight)
 {
     $min_age = $this->age_categories[$age_group][0];
     $max_age = $this->age_categories[$age_group][1];
     $min_birthday = Helper::calculateBirthday($min_age);
     $max_birthday = Helper::calculateBirthday($max_age);
     $results = User::whereRaw('gender = ? AND belt = ? AND weight = ? AND dob BETWEEN ? AND ? ', array($gender, $belt, $weight, $max_birthday, $min_birthday))->orderBy('dob')->get();
     // $queries = DB::getQueryLog();
     // $last_query = end($queries);
     // var_dump($results->all(), $last_query, $age_group);
     return $results;
 }
開發者ID:roycocup,項目名稱:bjjcomp2,代碼行數:12,代碼來源:User.php

示例4: index

 public function index()
 {
     $user = User::whereRaw('tel = ? and password = ?', array(Input::get('tel'), md5(Input::get('password'))))->first();
     if ($user) {
         $token = uniqid();
         Session::put('token', $token);
         Session::put('uid', $user->id);
         $user->school;
         unset($user->choolId);
         return array('code' => 0, 'data' => $user);
     } else {
         return array('code' => 1, 'data' => 'tel or psw error');
     }
 }
開發者ID:guodong,項目名稱:wish-api,代碼行數:14,代碼來源:AccesstokenController.php

示例5: login

 public function login()
 {
     $user = User::whereRaw('tel = ? and password = ?', array(Input::get('tel'), md5(Input::get('password'))))->first();
     if ($user) {
         //             if ($user->nickname == '' || $user->schoolId == '' || $user->avatarUrl == ''){
         //                 return $this->outputError('請完善用戶信息', 2);
         //             }
         Session::put('uid', $user->_id);
         $user->school;
         unset($user->schoolId);
         $user->tags;
         return $this->output($user);
     } else {
         return $this->outputError('tel or psw error', 2);
     }
 }
開發者ID:guodong,項目名稱:wish-api,代碼行數:16,代碼來源:AuthController.php

示例6: search

 /**
  * Return a json search result.
  *
  * @var $search
  * @return json
  */
 public function search($search)
 {
     $usersL = [];
     $users = User::whereRaw("name LIKE '%" . $search . "%' OR email LIKE '%" . $search . "%'")->take(10)->get();
     foreach ($users as $id => $user) {
         $usersL[] = ['id' => $user->id, 'name' => $user->name, 'email' => $user->email, 'score' => $user->score->value];
     }
     return response()->json($usersL);
 }
開發者ID:jmoreirafilho,項目名稱:SharingTests,代碼行數:15,代碼來源:UserController.php


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