Exemple #1
0
 public static function online()
 {
     if (is_bool(static::$isOnline)) {
         return static::$isOnline;
     } else {
         static::$isOnline = PersonModel::where(PersonModel::getField('for_audience'), 1)->count() > 0;
         return static::$isOnline;
     }
 }
Exemple #2
0
 /**
  * Returns offline Users, currently returns Eloquent user, should return
  * larachat user in near future
  * @return User[] Array with offline users
  */
 public static function getOffline()
 {
     // Get all users in DB
     $users = \User::all();
     // Array to return with results
     $offline_users = array();
     foreach ($users as $user) {
         // Obtain larachat user from Eloquent user
         $tempLaraUser = new static($user, $user->name);
         // If not online, add to result array
         if (!$tempLaraUser->isOnline()) {
             // add name as nick
             $user->nick = $user->name;
             $offline_users[] = $user;
         }
     }
     return $offline_users;
 }