Example #1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Repair::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, 'price' => $this->price, 'create_date' => $this->create_date]);
     $query->andFilterWhere(['like', 'truck_license', $this->truck_license])->andFilterWhere(['like', 'detail', $this->detail]);
     return $dataProvider;
 }
Example #2
0
 public function actionForm_create($truck_license = null)
 {
     $repair = Repair::find()->where(['truck_license' => $truck_license])->all();
     return $this->render('repair', ["truck_license" => $truck_license, "repair" => $repair]);
 }