/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = FakthaRiskStatus::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(['like', 'id', $this->id])->andFilterWhere(['like', 'name', $this->name]); return $dataProvider; }
public function getFakthaRiskStatus() { return $this->hasOne(FakthaRiskStatus::className(), ['id' => 'risk_status_id']); }
/** * Finds the FakthaRiskStatus model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param string $id * @return FakthaRiskStatus the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = FakthaRiskStatus::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
<?php echo $form->field($model, 'print_url')->textInput(['maxlength' => true]); ?> <?php echo $form->field($model, 'act_st')->textInput(['maxlength' => true]); ?> <?php echo $form->field($model, 'pic')->textInput(); ?> <div class="col-xs-6 col-sm-6"> <?php echo $form->field($model, 'risk_status')->widget(Select2::classname(), ['data' => ArrayHelper::map(FakthaRiskStatus::find()->all(), 'id', 'name'), 'options' => ['placeholder' => 'เลือกสถานะของรายการ ...'], 'pluginOptions' => ['allowClear' => true]]); ?> </div> <div class="form-group"> <?php echo Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => ($model->isNewRecord ? 'btn btn-success' : 'btn btn-primary') . ' btn-lg btn-block']); ?> </div> <?php ActiveForm::end(); ?>