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


PHP User::where方法代码示例

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


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

示例1: findAuthorFromEmail

 protected function findAuthorFromEmail($data)
 {
     if (!($email = array_get($data, 'email', $this->default_author))) {
         return null;
     }
     if (isset($this->authorEmailCache[$email])) {
         return $this->authorEmailCache[$email];
     }
     $author = AuthorModel::where('email', $email)->first();
     return $this->authorEmailCache[$email] = $author;
 }
开发者ID:richlove1,项目名称:avc-october,代码行数:11,代码来源:PostImport.php

示例2: onSendMail

 /**
  * Sending Mail
  * */
 public function onSendMail()
 {
     /**
      * Getting form results
      * */
     $group_id = post('group');
     $subject = post('subject');
     $msg = post('message');
     $test_email = post('testEmail');
     /**
      * Checking if there's no data
      * */
     if ($subject == "" || $msg == "") {
         return Flash::warning(Lang::get('lilessam.mailsender::lang.error_nodata'));
     }
     /**
      * Striping tags for the plain version of mail
      * */
     $msgPlain = strip_tags(post('message'));
     /**
      * Setting vars array for mail template
      * */
     $vars = ['subject' => $subject, 'msg' => $msg, 'msgPlain' => $msgPlain];
     /**
      * Check if the administrator want to send only a test message
      * */
     if ($test_email != "") {
         //email and subject array
         $array = ['email' => $test_email, 'subject' => $subject];
         //Sending mail
         Mail::send(['text' => $msgPlain, 'html' => $msg, 'raw' => true], $vars, function ($message) use($array) {
             $message->subject($array['subject']);
             $message->to($array['email'], "Test Reciever");
         });
         /**
          * Success message
          * */
         return Flash::success(Lang::get('lilessam.mailsender::lang.test.sent'));
     }
     /**
      * Getting users count in this group
      * */
     $users_count = DB::table('backend_users_groups')->where('user_group_id', $group_id)->count();
     /**
      * Checking if there's users in the group
      * */
     if ($users_count != 0) {
         //Fetching users
         $users_ids = DB::table('backend_users_groups')->where('user_group_id', $group_id)->get();
         /**
          * Looping to send mail to every user
          * */
         foreach ($users_ids as $user_id) {
             //The user
             $user = User::where('id', $user_id->user_id)->first();
             //User and subject array
             $array = ['user' => $user, 'subject' => $subject];
             //Sending mail
             Mail::send(['text' => $msgPlain, 'html' => $msg, 'raw' => true], $vars, function ($message) use($array) {
                 $message->subject($array['subject']);
                 $message->to($array['user']->email, $array['user']->login);
             });
         }
         /**
          * Success Message
          * */
         Flash::success(Lang::get('lilessam.mailsender::lang.sent') . $users_count . Lang::get('lilessam.mailsender::lang.users'));
     } else {
         /**
          * Warning message that there's no users in this group
          * */
         Flash::warning(Lang::get('lilessam.mailsender::lang.nousers'));
     }
 }
开发者ID:lilessam,项目名称:mailsender,代码行数:77,代码来源:Mailsender.php

示例3: index

 public function index()
 {
     # CHECK SETTINGS ARE DEFINED
     $this->checkSettings(['google_client_id', 'google_client_secret']);
     # CREATE GOOGLE CLIENT
     $client = new Google_Client();
     $client->setClientId(Settings::get('google_client_id'));
     $client->setClientSecret(Settings::get('google_client_secret'));
     $client->setRedirectUri(Backend::url('martin/ssologin/google'));
     $client->setScopes('email');
     # HANDLE LOGOUTS
     if (Input::has('logout')) {
         Session::forget('access_token');
         return;
     }
     # AUTHENTICATE GOOGLE USER
     if (Input::has('code')) {
         $client->authenticate(Input::get('code'));
         Session::put('access_token', $client->getAccessToken());
     }
     # SET ACCESS TOKEN OR GET A NEW ONE
     if (Session::has('access_token')) {
         $client->setAccessToken(Session::get('access_token'));
     } else {
         $authUrl = $client->createAuthUrl();
         // Redirect::to() doesn't work here. Send header manually.
         header("Location: {$authUrl}");
         exit;
     }
     # PARSE USER DETAILS
     if ($client->getAccessToken()) {
         Session::put('access_token', $client->getAccessToken());
         $token_data = $client->verifyIdToken();
     }
     # FORGET ACCESS TOKEN
     Session::forget('access_token');
     # CHECK MAIL EXISTS
     if (!isset($token_data['email'])) {
         # RECORD FAILED LOGIN
         $log = new Log();
         $log->provider = 'Google';
         $log->result = 'failed';
         $log->email = $email;
         $log->ip = Request::getClientIp();
         $log->save();
         Flash::error(trans('martin.ssologin::lang.errors.google.invalid_user'));
         return Backend::redirect('backend/auth/signin');
     }
     # FIND USER BY EMAIL
     $email = $token_data['email'];
     $user = User::where('email', $email)->first();
     # IF NO USER, GET BACK TO LOGIN SCREEN
     if (!$user) {
         # RECORD FAILED LOGIN
         $log = new Log();
         $log->provider = 'Google';
         $log->result = 'failed';
         $log->email = $email;
         $log->ip = Request::getClientIp();
         $log->save();
         Flash::error(trans('martin.ssologin::lang.errors.google.invalid_user'));
         return Backend::redirect('backend/auth/signin');
     }
     # LOGIN USER ON BACKEND
     BackendAuth::login($user, true);
     # RECORD SUCCESSFUL LOGIN
     $log = new Log();
     $log->provider = 'Google';
     $log->result = 'successful';
     $log->user_id = $user->id;
     $log->email = $email;
     $log->ip = Request::getClientIp();
     $log->save();
     // Load version updates
     UpdateManager::instance()->update();
     // Log the sign in event
     AccessLog::add($user);
     // Redirect to the intended page after successful sign in
     return Backend::redirectIntended('backend');
 }
开发者ID:skydiver,项目名称:october-plugin-ssologin,代码行数:80,代码来源:Google.php

示例4: getAuthorInfo

 public function getAuthorInfo($id)
 {
     $user = BackendUserModel::where('id', $id)->first();
     if ($user->avatar) {
         $user->image = $user->avatar->getThumb(100, 100, ['mode' => 'crop']);
     }
     return $user;
 }
开发者ID:betes-curieuses-design,项目名称:AllianceEducation,代码行数:8,代码来源:Plugin.php

示例5: formAfterDelete

 public function formAfterDelete($model)
 {
     \Backend\Models\User::where('team_id', $model->id)->update(['team_id' => 0]);
 }
开发者ID:danielbsabr,项目名称:OctoberCMS_Sitepoint_plugin_demo,代码行数:4,代码来源:Teams.php


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