/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = FakthaRiskSimple::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(['like', 'name', $this->name]); return $dataProvider; }
public function getFakthaRiskSimple() { return $this->hasOne(FakthaRiskSimple::className(), ['id' => 'risk_simple_id']); }
/** * Finds the FakthaRiskSimple model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return FakthaRiskSimple the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = FakthaRiskSimple::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
<?php echo $form->field($model, 'risk_program_text')->textInput(['maxlength' => true]); ?> <?php echo $form->field($model, 'login_name')->textInput(['maxlength' => true]); ?> <?php echo $form->field($model, 'risk_sum_dep')->textInput(); ?> <?php echo $form->field($model, 'risk_simple')->widget(Select2::classname(), ['data' => ArrayHelper::map(FakthaRiskSimple::find()->all(), 'id', 'name'), 'options' => ['placeholder' => 'เลือกรายการตาม simple ...'], 'pluginOptions' => ['allowClear' => true]]); ?> <?php echo $form->field($model, 'date_input')->widget(DatePicker::classname(), ['language' => 'th', 'dateFormat' => 'yyyy-MM-dd', 'clientOptions' => ['changeMonth' => true, 'changeYear' => true], 'options' => ['class' => 'form-control']]); ?> <?php echo $form->field($model, 'last_update')->textInput(); ?> <?php echo $form->field($model, 'last_staff')->textInput(['maxlength' => true]); ?>