当前位置: 首页>>代码示例>>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;未经允许,请勿转载。