/** * 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; }
/** * 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; }