Exemple #1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = CatModel::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id]);
     $query->andFilterWhere(['like', 'code', $this->code])->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'full_name', $this->full_name]);
     return $dataProvider;
 }
Exemple #2
0
/* @var $this yii\web\View */
/* @var $model app\models\Car */
/* @var $form yii\widgets\ActiveForm */
?>

<div class="car-form">

    <?php 
$form = ActiveForm::begin();
?>

    <?php 
//= $form->field($model, 'model_id')->textInput()
?>
    <?php 
echo $form->field($model, 'model_id')->widget(Select2::classname(), ['data' => ArrayHelper::map(Mod\CatModel::find()->all(), 'id', 'full_name')]);
?>

    <?php 
echo $form->field($model, 'color_id')->widget(Select2::classname(), ['data' => ArrayHelper::map(Mod\Color::find()->all(), 'id', 'name'), 'language' => Yii::$app->language]);
?>

	<?php 
echo $form->field($model, 'color_sal_id')->dropDownList(ArrayHelper::map(Mod\ColorSalon::find()->all(), 'id', 'name'), ['prompt' => Yii::t('app', 'Select salon color')]);
?>

    <?php 
echo $form->field($model, 'vin')->textInput(['maxlength' => 17]);
?>

    <?php