/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = InsuranceCompanies::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]); $query->andFilterWhere(['ilike', 'code', $this->code])->andFilterWhere(['ilike', 'description', $this->description])->andFilterWhere(['ilike', 'address', $this->address])->andFilterWhere(['ilike', 'email_address', $this->email_address]); unset($_SESSION['exportData']); $_SESSION['exportData'] = $dataProvider; return $dataProvider; }
/** * Finds the InsuranceCompanies model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return InsuranceCompanies the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = InsuranceCompanies::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
<div class="col-xs-12 col-lg-12 no-padding"> <p> </p> </div> <?php if (\Yii::$app->user->can('admin')) { ?> <div class="col-xs-12 col-lg-12 no-padding"> <div class="col-sm-6"> <?php echo $form->field($model, 'user_level')->dropDownList(ArrayHelper::map(AuthItem::find()->where(['type' => 1])->all(), 'name', 'description'), ['id' => 'user_level', 'prompt' => 'Type of User'])->label(''); ?> </div> <div class="col-sm-6" id="parent_insurance"> <?php echo $form->field($model, 'parent_insurance_company')->dropDownList(ArrayHelper::map(InsuranceCompanies::find()->all(), 'id', 'code'), ['id' => 'parent_ins', 'prompt' => 'Select Insurance Company'])->label(''); ?> </div> </div> <?php } ?> <div class="col-xs-12 col-lg-12 no-padding"> <div class="col-sm-6"> <?php echo $form->field($model, 'username', ['inputOptions' => ['class' => 'form-control', 'placeholder' => 'Username']])->textInput()->label(''); ?> </div> <div class="col-sm-6"> <?php
/** * @return \yii\db\ActiveQuery */ public function getInsuranceCompany() { return $this->hasOne(InsuranceCompanies::className(), ['id' => 'insurance_company']); }