[ 'class' => VerbFilter::className(), 'actions' => [ 'delete' => ['post'], ], ], 'access' => [ 'class' => AccessControl::className(), 'rules' => [ [ 'allow' => true, 'roles' => ['@'], 'matchCallback' => function ($rule, $action) { return User::getCurrentStatus() == USER::STATUS_ADMIN; } ] ], ], ]; } /** * Liste les producteurs. * * @return mixed */ public function actionIndex() { $dataProviderTaxRate = new ActiveDataProvider([ 'query' => TaxRate::find() ]); return $this->render('index', [ 'dataProviderTaxRate' => $dataProviderTaxRate, ]); } /** * Crée un producteur. * * @return mixed */ public function actionCreate() { $model = new TaxRate(); if ($model->load(Yii::$app->request->post()) && $model->save()) { Yii::$app->getSession()->setFlash('success', 'Taxe créé.'); return $this->redirect(['index']); } else { return $this->render('create', [ 'model' => $model, ]); } } }