/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Cp::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', 'cp_name', $this->cp_name]); return $dataProvider; }
?> <?php echo $form->field($model, 'app_name')->textInput(['maxlength' => true]); ?> <?php echo $form->field($model, 'app_code')->textInput(['maxlength' => true]); ?> <?php echo $form->field($model, 'version')->textInput(['maxlength' => true]); ?> <?php echo $form->field($model, 'cp_id')->dropDownList(\yii\helpers\ArrayHelper::map(\common\models\Cp::find()->all(), 'id', 'cp_name')); ?> <?php echo $form->field($model, 'active')->dropDownList([1 => '激活', 0 => '不激活']); ?> <?php echo $form->field($model, 'api_url')->textInput(['maxlength' => true]); ?> <div class="form-group"> <?php echo Html::submitButton($model->isNewRecord ? Yii::t('app', '新增') : Yii::t('app', '修改'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']); ?> </div> <?php