Exemplo n.º 1
0
 /**
  * {@inheritDoc}
  */
 public function render()
 {
     $today = date('Y-m-d');
     $thisWeek = date('Y-m-d', strtotime('last monday'));
     $this->addCss('css/friendstoolbar.css');
     $meta = new Usermeta();
     $meta_table = $meta->getTable();
     $this->vars['numFriends'] = Usermeta::where('current_member', '!=', Usermeta::IS_STAFF)->count();
     $this->vars['todayFriends'] = User::join($meta_table, 'users.id', '=', $meta_table . '.user_id')->where('current_member', '!=', Usermeta::IS_STAFF)->where('created_at', '>=', $today)->count();
     $this->vars['weekFriends'] = User::join($meta_table, 'users.id', '=', $meta_table . '.user_id')->where('current_member', '!=', Usermeta::IS_STAFF)->where('created_at', '>=', $thisWeek)->count();
     $this->vars['averageFriends'] = $this->getAverageFriends();
     return $this->makePartial('widget');
 }
Exemplo n.º 2
0
 public function getOptinFriends($friends)
 {
     $numWithOptin = Usermeta::where('email_optin', 1)->count();
     return round($numWithOptin / $friends * 100);
 }