コード例 #1
0
 /**
  * Execute the controller.
  *
  * @return  mixed Return executed result.
  *
  * @throws  \LogicException
  * @throws  \RuntimeException
  */
 public function execute()
 {
     $model = new LoginModel();
     $user = User::get();
     if ($user->isNull()) {
         $this->setRedirect('login', 'Already logout', 'success');
     }
     $model->logout($user->username);
     $this->setRedirect('login', 'Logout success', 'success');
     return true;
 }
コード例 #2
0
 /**
  * Execute the controller.
  *
  * @return  mixed Return executed result.
  *
  * @throws  \LogicException
  * @throws  \RuntimeException
  */
 public function doExecute()
 {
     $model = new LoginModel();
     $router = $this->package->getRouter();
     $user = User::get();
     if ($user->isNull()) {
         $this->setRedirect($router->http('login', array(), Router::TYPE_FULL), 'Already logout', 'success');
     }
     $model->logout($user->username);
     $this->setRedirect($router->http('login', array(), Router::TYPE_FULL), 'Logout success', 'success');
     return true;
 }