/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = RatingProfile::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(['id' => $this->id, 'first_update' => $this->first_update, 'last_update' => $this->last_update]); $query->andFilterWhere(['like', 'desc', $this->desc])->andFilterWhere(['like', 'first_user', $this->first_user])->andFilterWhere(['like', 'first_ip', $this->first_ip])->andFilterWhere(['like', 'last_user', $this->last_user])->andFilterWhere(['like', 'last_ip', $this->last_ip]); return $dataProvider; }
/** * Finds the RatingProfile model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return RatingProfile the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = RatingProfile::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
?> <?php echo $form->field($model, 'virtual_id')->dropDownList(ArrayHelper::map(Virtual::find()->all(), 'id', 'name'), ['prompt' => 'Select Virutal']); ?> <?php echo $form->field($model, 'area_code')->textInput(); ?> <?php echo $form->field($model, 'office_code')->textInput(); ?> <?php echo $form->field($model, 'rating_id')->dropDownList(ArrayHelper::map(RatingProfile::find()->all(), 'id', 'desc'), ['prompt' => 'Select Rating']); ?> <?php echo $form->field($model, 'wallet')->textInput(['maxlength' => true]); ?> <div class="form-group"> <?php echo Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']); ?> </div> <?php ActiveForm::end(); ?>
/** * @return \yii\db\ActiveQuery */ public function getRating() { return $this->hasOne(RatingProfile::className(), ['id' => 'rating_id']); }