[ 'class' => AccessControl::className(), //'only' => ['logout','index'], 'rules' => [ [ 'actions' => ['index','save','delete'], 'allow' => true, 'roles' => ['admin'], ], ], ], 'verbs' => [ 'class' => VerbFilter::className(), 'actions' => [ 'logout' => ['post'], ], ], ]; } public function actionIndex() { $dataProvider = new ActiveDataProvider([ 'query' => Mod::find()->where('product_id=:product_id',[':product_id'=>$_GET['productID']])->orderBy('id'), 'pagination' => [ 'pageSize' => 20, ], ]); return $this->render('index',['dataProvider'=>$dataProvider]); } public function actionSave() { $model = (!empty($_GET['id'])) ? Mod::findOne($_GET['id']) : new Mod; if ($model->load(Yii::$app->request->post()) && $model->save()) { return Yii::$app->response->redirect(['/admin/mod/index','productID'=>$_GET['productID'],'catID'=>$_GET['catID']]); } return $this->render('save',['model'=>$model]); } public function actionDelete(){ $model = Mod::findOne($_GET['id']); $model->delete(); return Yii::$app->response->redirect(['/admin/mod/index','productID'=>$_GET['productID'],'catID'=>$_GET['catID']]); } }