コード例 #1
0
 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');
 }
コード例 #2
0
 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');
 }
コード例 #3
0
 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();
 }
コード例 #4
0
ファイル: SyncUsers.php プロジェクト: abnmt/oc-mrc-plugin
 /**
  * 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'    => '*****@*****.**',
             //     'password' => $pass,
             // ]);
             echo " [+]\n";
         }
     });
     echo "\n";
     $cmsusers = CMSUser::count();
     // echo "\n";
     // print_r($crmusers);
     // echo "\n";
     // print_r($cmsusers);
     // echo "\n";
 }
コード例 #5
0
 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');
 }