public function actionLogout()
    {
        $event = $this->getUserEvent(\Yii::$app->user->identity);

        $this->trigger(self::EVENT_BEFORE_LOGOUT, $event);

        \Yii::$app->getUser()->logout();

        $this->trigger(self::EVENT_AFTER_LOGOUT, $event);

        \Yii::$app->getResponse()->redirect(Url::to([\Yii::$app->getHomeUrl()]));
    }
public function actionLogout()
    {
        $event = $this->getUserEvent(\Yii::$app->user->identity);

        $this->trigger(self::EVENT_BEFORE_LOGOUT, $event);

        \Yii::$app->getUser()->logout();

        $this->trigger(self::EVENT_AFTER_LOGOUT, $event);

        \Yii::$app->getResponse()->redirect(Url::to([\Yii::$app->getHomeUrl()]));
    }
public function actionLogout ( ) { $ event = $ this -> getUserEvent ( \ Yii :: $ app -> user -> identity ) ; $ this -> trigger ( self :: EVENT_BEFORE_LOGOUT , $ event ) ; \ Yii :: $ app -> getUser ( ) -> logout ( ) ; $ this -> trigger ( self :: EVENT_AFTER_LOGOUT , $ event ) ; \ Yii :: $ app -> getResponse ( ) -> redirect ( Url :: to ( [ \ Yii :: $ app -> getHomeUrl ( ) ] ) ) ; }
Logs the user out and then redirects to the homepage.

@return Response
Logs the user out and then redirects to the homepage .