public function setOnlineStatus() { $status = \Input::get('status'); if (\Auth::check()) { \Auth::user()->updateStatus($status, true); } }
public function index() { if (!$this->exists()) { return $this->profileNotFound(); } if (\Auth::check() and $this->blockUserRepository->hasBlock(\Auth::user()->id, $this->profileUser->id)) { return \Redirect::route('user-home'); } echo $this->render('profile.index', [], ['title' => $this->setTitle()]); }
public function process() { usleep(2000000); $results = ['status' => 'login']; if (!\Auth::check()) { return json_encode($results); } $this->realTimeRepository->setType('update'); $results['status'] = true; $results['lastaccess'] = $this->realTimeRepository->getLastAccess(\Auth::user()->id); $messageUserId = \Input::get('messageuserid'); $postType = \Input::get('postType'); $currentTime = date('Y-m-d H:i:s', time()); $lastaccess = \Input::get('lastaccess'); $continue = true; $results['lastaccess'] = $this->realTimeRepository->getLastAccess(\Auth::user()->id); if ($this->realTimeRepository->has(\Auth::user()->id, 'notification', $lastaccess)) { $results['notifications'] = $this->notificationRepository->count(); $this->realTimeRepository->remove(\Auth::user()->id, 'notification'); $continue = false; } if ($this->realTimeRepository->has(\Auth::user()->id, 'friend-request', $lastaccess)) { $results['requests'] = $this->connectionRepository->countFriendRequest(); $this->realTimeRepository->remove(\Auth::user()->id, 'friend-request'); $continue = false; } if ($this->realTimeRepository->has(\Auth::user()->id, 'message', $lastaccess)) { if ($messageUserId) { $lastime = \Input::get('messagelastcheck'); if ($lastime) { $messages = $this->messageRepository->getList($messageUserId, 10, 0, $lastime); $results['messages'] = (string) $this->theme->section('messages.paginate', ['messages' => $messages]); } } $this->realTimeRepository->remove(\Auth::user()->id, 'message'); $continue = false; } clearstatcache(storage_path('realtime/')); $results['messagelastcheck'] = $currentTime; $results['postlastcheck'] = $currentTime; $results['onlines'] = $this->userRepository->countFriendsOnline(); $results['unreadmessage'] = $this->messageRepository->countNew(); if ($postType) { $lastime = \Input::get('postlastcheck'); if ($lastime) { $results['posts'] = (string) $this->theme->section('post.paginate', ['posts' => $this->postRepository->lists($postType, 0, \Input::get('postUserid'), $lastime)]); } } return json_encode($results); }
public function logout() { \Auth::logout(); \Session::flush(); //\Session::forget(); sleep(1); \Auth::logout(); if (\Auth::check()) { $user = \Auth::user(); $user->last_active_time = time() - 3600; $user->updateStatus(0); $user->save(); } return \Redirect::to('/'); }