Beispiel #1
0
 /**
  * Creates a new Paginas model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return string|\yii\web\Response
  */
 public function run($categoria = null)
 {
     $model = new Paginas();
     $modelCategoria = new PaginasCategorias();
     if (!empty($categoria)) {
         $model->categoria = $modelCategoria->obtenerIdCategoria($categoria);
     }
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         return $this->controller->redirect(['detalle', 'id' => $model->idpagina]);
     } else {
         return $this->controller->render('create', ['model' => $model]);
     }
 }