Example #1
0
 /**
  * Check errors before saving
  * Update last online and cookie hash
  *
  * @return boolean
  */
 protected function beforeSave()
 {
     if (!$this->checkErrors()) {
         return false;
     }
     if (!$this->id) {
         $this->created = \App\Timer::now();
     }
     $this->makeCookieHash();
     return true;
 }
Example #2
0
 /**
  * Store users login data - ip and visit time
  *
  * @param \Models\User $user
  * @return void
  */
 private static function saveUserVisit(Models\User $user)
 {
     $user->lastVisit = Timer::now();
     $user->lastIP = Request::clientIP();
     $user->save(['lastVisit', 'lastIP', 'cookie']);
 }