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


PHP User::count方法代碼示例

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


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

示例1: render

 public function render()
 {
     $friends = User::count();
     $optin = Usermeta::where('email_optin', 1)->count();
     $notOptin = $friends - $optin;
     $this->vars['optin'] = number_format($optin);
     $this->vars['notOptin'] = number_format($notOptin);
     $this->vars['percent'] = round($optin / $friends * 100) . '%';
     return $this->makePartial('widget');
 }
開發者ID:janusnic,項目名稱:OctoberFriends,代碼行數:10,代碼來源:EmailOptin.php

示例2: render

 public function render()
 {
     $friends = User::count();
     $partners = Usermeta::select('id')->where('current_member', Usermeta::IS_MEMBER)->count();
     $notPartners = $friends - $partners;
     $this->vars['totalFriends'] = number_format($friends);
     $this->vars['notPartners'] = number_format($notPartners);
     $this->vars['partners'] = number_format($partners);
     $this->vars['partnerPercent'] = round($partners / $friends * 100) . '%';
     return $this->makePartial('widget');
 }
開發者ID:janusnic,項目名稱:OctoberFriends,代碼行數:11,代碼來源:FriendsMembers.php

示例3: synchronizeUser

 protected function synchronizeUser()
 {
     $alwaysUpdate = $this->option('force-update');
     $this->progressbar = $this->getHelperSet()->get('progress');
     $this->progressbar->start($this->output, User::count());
     User::chunk(500, function ($users) use($alwaysUpdate) {
         foreach ($users as $user) {
             $this->progressbar->advance();
             $email = $user->email;
             MailChimpIntegration::syncMemberToMailChimp($email, $user, false);
         }
     });
     ${$this}->progressbar->finish();
 }
開發者ID:janusnic,項目名稱:OctoberFriends,代碼行數:14,代碼來源:SyncFriendsToMailChimp.php

示例4: fire

 /**
  * Execute the console command.
  * @return void
  */
 public function fire()
 {
     $this->output->writeln('Hello world!');
     $crmusers = CRMUser::isNotUpdated()->isHaveEmail()->get();
     echo "Processing Users: \n";
     $crmusers->each(function ($user) {
         $validator = \Validator::make(['email' => $user->email], ['email' => 'email']);
         if ($validator->fails()) {
             echo $user->email . " not valid email! [-]" . "\n";
         } else {
             $cmsuser = CMSUser::firstOrNew(['username' => $user->email]);
             echo $user->email . " ";
             $cmsuser->fill($user->toArray());
             if (!$cmsuser->is_activated) {
                 $pass = str_random(12);
                 $cmsuser->password = $pass;
                 $cmsuser->password_confirmation = $pass;
                 echo ": " . $pass;
             }
             $user->is_updated = true;
             $user->save();
             $cmsuser->save();
             if (!$cmsuser->is_activated) {
                 $code = implode('!', [$cmsuser->id, $cmsuser->getActivationCode()]);
                 $link = Page::url('personal', ['code' => $code]);
                 $data = ['name' => $cmsuser->name, 'link' => $link, 'code' => $code];
                 Mail::send('abnmt.mrc::mail.activate', $data, function ($message) use($cmsuser) {
                     $message->to($cmsuser->email, $cmsuser->name);
                 });
             }
             // if (!$cmsuser->is_activated) {
             //     try { $cmsuser->attemptActivation($cmsuser->activation_code);} catch (\Exception $e) {echo " EXCEPTION!";}
             // }
             // \Mail::sendTo($this, 'backend::mail.invite', [
             //     'name'     => $user->name,
             //     'email'    => 'mrc@abnmt.com',
             //     'password' => $pass,
             // ]);
             echo " [+]\n";
         }
     });
     echo "\n";
     $cmsusers = CMSUser::count();
     // echo "\n";
     // print_r($crmusers);
     // echo "\n";
     // print_r($cmsusers);
     // echo "\n";
 }
開發者ID:abnmt,項目名稱:oc-mrc-plugin,代碼行數:53,代碼來源:SyncUsers.php

示例5: render

 public function render()
 {
     $results = Usermeta::select(DB::raw('count(user_id) as count'), 'gender')->groupBy('gender')->get();
     $count = User::count();
     $total = 0;
     foreach ($results as $result) {
         if (empty($result->gender)) {
             continue;
         }
         $data[$result->gender] = $result->count;
         $total += $result->count;
     }
     $data[Lang::get('dma.friends::lang.user.noGender')] = $count - $total;
     arsort($data);
     $this->vars['data'] = $data;
     return $this->makePartial('widget');
 }
開發者ID:janusnic,項目名稱:OctoberFriends,代碼行數:17,代碼來源:DemographicGender.php


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