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