Advertisement
Guest User

Untitled

a guest
Jan 30th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.35 KB | None | 0 0
  1. # USER MODEL
  2.  
  3.     public function isOnline()
  4.     {
  5.         return $this->accounting()->latest('ts')->limit(1)->select('rtype');
  6.     }
  7.  
  8. # CONTROLLER
  9.  
  10.     $isOnline = $user->isOnline()->pluck('rtype')->toArray();
  11.     if (isset($isOnline[0]) && $isOnline[0] === 'Alive') {
  12.         $info[] = 'Online';
  13.     } else {
  14.         $info[] = 'Offline';
  15.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement