Advertisement
Guest User

Untitled

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