controllers/SiteController.php
/**
     * Displays about page.
     *
     * @return string
     */
Displays about page.
@return string
Displays about page . @return string
public function actionReviews()
    {
        $page = Page::viewPage(8);
        $model = new ReviewForm();
        if ($model->load(Yii::$app->request->post()) && $model->send()) {
            Yii::$app->session->setFlash('reviewSubmitted');
            return $this->redirect(['', '#' => 'card-form']);
        }
        $dataProvider = new ActiveDataProvider([
            'query' => Review::find()
                ->where(['status' => Review::STATUS_PUBLISHED])
                ->andWhere(['product_id' => null]),
            'sort' => [
                'defaultOrder' => [
                    'position' => SORT_DESC
                ],
            ],
        ]);
        return $this->render('reviews', [
            'page' => $page,
            'model' => $model,
            'dataProvider' => $dataProvider,
        ]);
    }
public function actionReviews ( ) { $ page = Page :: viewPage ( 8 ) ; $ model = new ReviewForm ( ) ; if ( $ model -> load ( Yii :: $ app -> request -> post ( ) ) && $ model -> send ( ) ) { Yii :: $ app -> session -> setFlash ( 'reviewSubmitted' ) ; return $ this -> redirect ( [ '' , '#' => 'card-form' ] ) ; } $ dataProvider = new ActiveDataProvider ( [ 'query' => Review :: find ( ) -> where ( [ 'status' => Review :: STATUS_PUBLISHED ] ) -> andWhere ( [ 'product_id' => null ] ) , 'sort' => [ 'defaultOrder' => [ 'position' => SORT_DESC ] , ] , ] ) ; return $ this -> render ( 'reviews' , [ 'page' => $ page , 'model' => $ model , 'dataProvider' => $ dataProvider , ] ) ; }
Displays about page.
Displays about page .