public function actionPermissions($id) { //$model= DatabasesPerm::findOne($id); $model = new DatabasesPerm(); $model->scenario = 'search'; //$model->unsetAttributes(); // clear any default values $model->database_id = $id; $user = new DatabasesPerm(); $user->database_id = $id; if ($user->load(Yii::$app->request->post())) { $user->save(); //if($model->save()) // $this->redirect(array('index')); } return $this->render('permissions', array('model' => $model, 'user' => $user)); }