Exemplo n.º 1
0
 public function actionSurplus($id)
 {
     /* @var $model Goods */
     $model = Goods::findOne(['id' => $id, 'store_id' => Yii::$app->user->identity->store_id]);
     if (!$model) {
         throw new NotFoundHttpException('未找到该商品。');
     }
     $dataProvider = new ActiveDataProvider(['query' => GoodsSurplus::find()->where(['goods_id' => $id]), 'sort' => ['defaultOrder' => ['id' => SORT_DESC]], 'pagination' => ['pageSize' => 20]]);
     return $this->render('surplus', ['model' => $model, 'dataProvider' => $dataProvider]);
 }