Example #1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Drivers::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, 'car' => $this->car, 'count' => $this->count]);
     $query->andFilterWhere(['like', 'fullname', $this->fullname])->andFilterWhere(['like', 'sname', $this->sname])->andFilterWhere(['like', 'fname', $this->fname])->andFilterWhere(['like', 'address', $this->address])->andFilterWhere(['like', 'address1', $this->address1])->andFilterWhere(['like', 'idcardN', $this->idcardN])->andFilterWhere(['like', 'photo', $this->photo])->andFilterWhere(['like', 'phone', $this->phone])->andFilterWhere(['like', 'phone1', $this->phone1])->andFilterWhere(['like', 'email', $this->email])->andFilterWhere(['like', 'bday', $this->bday]);
     return $dataProvider;
 }
Example #2
0
File: Auto.php Project: t4le/365
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getDrivers()
 {
     return $this->hasMany(Drivers::className(), ['car' => 'id']);
 }
Example #3
0
 /**
  * Finds the Drivers model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Drivers the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Drivers::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }