[ 'class' => VerbFilter::className(), 'actions' => [ 'delete' => ['post'], ], ], ]; } /** * Lists all BrandsReplace models. * @return mixed */ public function actionIndex() { $searchModel = new BrandsReplaceSearch(); $dataProvider = $searchModel->search(Yii::$app->request->queryParams); return $this->render('index', [ 'searchModel' => $searchModel, 'dataProvider' => $dataProvider, ]); } /** * Displays a single BrandsReplace model. * @param string $from_brand * @param string $to_brand * @return mixed */ public function actionView($from_brand, $to_brand) { return $this->render('view', [ 'model' => $this->findModel($from_brand, $to_brand), ]); } /** * Creates a new BrandsReplace model. * If creation is successful, the browser will be redirected to the 'view' page. * @return mixed */ public function actionCreate() { $model = new BrandsReplace(); if ($model->load(Yii::$app->request->post()) && $model->save()) { return $this->redirect(['view', 'from_brand' => $model->from_brand, 'to_brand' => $model->to_brand]); } else { return $this->render('create', [ 'model' => $model, ]); } } /** * Updates an existing BrandsReplace model. * If update is successful, the browser will be redirected to the 'view' page. * @param string $from_brand * @param string $to_brand * @return mixed */ public function actionUpdate($from_brand, $to_brand) { $model = $this->findModel($from_brand, $to_brand); if ($model->load(Yii::$app->request->post()) && $model->save()) { return $this->redirect(['view', 'from_brand' => $model->from_brand, 'to_brand' => $model->to_brand]); } else { return $this->render('update', [ 'model' => $model, ]); } } /** * Deletes an existing BrandsReplace model. * If deletion is successful, the browser will be redirected to the 'index' page. * @param string $from_brand * @param string $to_brand * @return mixed */ public function actionDelete($from_brand, $to_brand) { $this->findModel($from_brand, $to_brand)->delete(); return $this->redirect(['index']); } /** * Finds the BrandsReplace model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param string $from_brand * @param string $to_brand * @return BrandsReplace the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($from_brand, $to_brand) { if (($model = BrandsReplace::findOne(['from_brand' => $from_brand, 'to_brand' => $to_brand])) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } } }