/** * Updates an existing Predio model. * If update is successful, the browser will be redirected to the 'view' page. * @param integer $id * @return mixed */ public function actionUpdate($id) { $model = $this->findModel($id); $searchModel = new SalaSearch(); $searchModel->predio_idpredio = $id; // filtra a passagem para somente a viagem selecionada $dataProvider = $searchModel->search(Yii::$app->request->queryParams); if ($model->load(Yii::$app->request->post()) && $model->save()) { return $this->redirect(['view', 'id' => $model->idpredio]); } else { return $this->render('update', array('model' => $model, 'searchModel' => $searchModel, 'dataProvider' => $dataProvider)); } }
/** * Lists all Sala models. * @return mixed */ public function actionIndex() { $searchModel = new SalaSearch(); $dataProvider = $searchModel->search(Yii::$app->request->queryParams); return $this->render('index', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider]); }