public function actionClearList()
    {
        if (!Yii::$app->user->isGuest) {
            ViewedProduct::deleteAll(['user_id' => \Yii::$app->user->id]);
            return $this->redirect(['list']);
        } else throw new NotFoundHttpException();
    }
public function actionClearList()
    {
        if (!Yii::$app->user->isGuest) {
            ViewedProduct::deleteAll(['user_id' => \Yii::$app->user->id]);
            return $this->redirect(['list']);
        } else throw new NotFoundHttpException();
    }
public function actionClearList ( ) { if ( ! Yii :: $ app -> user -> isGuest ) { ViewedProduct :: deleteAll ( [ 'user_id' => \ Yii :: $ app -> user -> id ] ) ; return $ this -> redirect ( [ 'list' ] ) ; } else throw new NotFoundHttpException ( ) ; }
Deletes all user viewed products.

@return \yii\web\Response
@throws NotFoundHttpException
Deletes all user viewed products .