public function searchAdmin($params) { $query = PrefixCapability::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); $this->load($params); if (!$this->validate()) { // uncomment the following line if you do not want to return any records when validation fails // $query->where('0=1'); return $dataProvider; } $query->andFilterWhere(['no' => $this->no, 'prefix_id' => $this->prefix_id]); $query->andFilterWhere(['like', 'codec_type', $this->codec_type]); return $dataProvider; }
public function actionCreateVirtual() { $model = new Prefix(); $modelPrefixCapability = new PrefixCapability(); if ($model->load(Yii::$app->request->post()) && $model->save()) { GlobalFunctionController::activity_user("[CREATE PREFIX] Prefix : {$model->prefix} ,Description : {$model->description}, Virtual : {$model->virtual_id}, Type : {$model->type}"); Yii::$app->Controllers->historyUserWithData($model); if ($model->codec_type != "") { $modelPrefixCapability->prefix_id = $model->id; $modelPrefixCapability->codec_type = $model->codec_type; $modelPrefixCapability->save(); } echo 1; //return $this->redirect(['view', 'id' => $model->id]); } else { return $this->renderAjax('create_virtual', ['model' => $model]); } }
/** * Finds the PrefixCapability model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return PrefixCapability the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = PrefixCapability::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }