check() public method

Checks to see if a user is logged in.
public check ( ) : Cartalyst\Sentinel\Users\UserInterface | boolean
return Cartalyst\Sentinel\Users\UserInterface | boolean
Example #1
0
 public function getLogout()
 {
     try {
         if (!!($user = $this->sentinel->check())) {
             $this->setResponseData($this->sentinel->logout(null, true));
         } else {
             throw new \Exception("Can't get current user");
         }
     } catch (\Exception $e) {
         $this->setErrorData($e->getMessage());
     }
     return $this->responseJson();
 }
 public function postRemoveCustomDataById(Request $request)
 {
     try {
         $data = $this->getRequestData($request);
         if (!!($user = $this->sentinel->check())) {
             $this->setResponseData($this->userCustomerDataModel->removeCustomDataById($data['id'], $user));
         } else {
             throw new \Exception("Can't get current user");
         }
     } catch (\Exception $e) {
         $this->setErrorData($e->getMessage());
     }
     return $this->responseJson();
 }
Example #3
0
 /**
  * Checks to see if a user is logged in.
  *
  * @return User|bool
  */
 public function check()
 {
     return $this->sentinel->check();
 }
Example #4
0
 /**
  * Checks to see if a user is logged in.
  *
  * @return \Cartalyst\Sentinel\Users\UserInterface|bool 
  * @static 
  */
 public static function check()
 {
     return \Cartalyst\Sentinel\Sentinel::check();
 }