public function insert(array $data) { $stat = new Stat(); $stat->fill($data); if (!$stat->isValid()) { return $stat->getValidationErrors(); } $stat->save(); return $stat; }
/** * Collect stats on user login * @return [type] [description] */ private function collectStat($user) { //collect stats on users Log::info('collecting'); $stat = new Stat(); $stat->user_id = $user->email; $stat->last_login = Stat::lastLoginDate($user); $stat->ip = $_SERVER['REMOTE_ADDR']; $stat->browser = $_SERVER['HTTP_USER_AGENT']; $stat->save(); }