Exemplo n.º 1
0
 /**
  * Creates a new UrlRewrite model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     /** @var \core\rewrite\models\UrlRewrite $model */
     $model = Kiwi::getUrlRewrite();
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         return $this->redirect(['index']);
     } else {
         return $this->render('/rewrite/create', ['model' => $model]);
     }
 }
Exemplo n.º 2
0
 public function createUrl($manager, $route, $params)
 {
     /** @var \core\rewrite\models\UrlRewrite $urlRewrite */
     $urlRewrite = Kiwi::getUrlRewrite();
     $paramsPath = $urlRewrite->getParamsPath($params);
     $urlRewrite = $urlRewrite::findOne(['route' => $route, 'params' => $paramsPath]);
     if ($urlRewrite) {
         return $urlRewrite->request_path . ($this->suffix === null ? $manager->suffix : $this->suffix);
     }
     return false;
     // this rule does not apply
 }