Exemplo n.º 1
0
 public function actionIndex()
 {
     $data = Coupons::find()->where(['>', 'coupon_expire_time', time()]);
     $get = Yii::$app->request->get();
     if (!empty($get)) {
         Coupons::setNewCoupon($get);
         $this->redirect('/coupon');
     }
     $dataProvider = new ActiveDataProvider(['query' => $data]);
     return $this->render('index', ['dataProvider' => $dataProvider]);
 }