| Current Path : /var/www/html/ebookingdbkl/backend/modules/serviceApplication/models/ |
| Current File : /var/www/html/ebookingdbkl/backend/modules/serviceApplication/models/ServiceImgSearch.php |
<?php
namespace backend\modules\serviceApplication\models;
use yii\base\Model;
use yii\data\ActiveDataProvider;
use backend\modules\serviceApplication\models\ServiceImg;
/**
* ServiceImgSearch represents the model behind the search form of `backend\modules\serviceApplication\models\ServiceImg`.
*/
class ServiceImgSearch extends ServiceImg {
/**
* {@inheritdoc}
*/
public function rules() {
return [
[['created_at', 'updated_at', 'img_path', 'img_remarks', 'service_id'], 'safe'],
[['created_by', 'updated_by','img_sort'], 'integer'],
];
}
/**
* {@inheritdoc}
*/
public function scenarios() {
// bypass scenarios() implementation in the parent class
return Model::scenarios();
}
/**
* Creates data provider instance with search query applied
*
* @param array $params
*
* @return ActiveDataProvider
*/
public function search($params) {
// $query = ServiceImg::find()->leftJoin('service_application t2', 't2.service_id=service_img.service_id');
$query = ServiceImg::find();
// add conditions that should always apply here
$dataProvider = new ActiveDataProvider(['query' => $query, 'pagination' => ['pageSize' => 10,]]);
$dataProvider->setSort(['defaultOrder' => ['updated_at' => SORT_DESC]]);
$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;
}
// grid filtering conditions
$query->andFilterWhere(['=', 'img_id', $this->img_id]);
$query->andFilterWhere(['=', 'service_id', $this->service_id]);
// $query->andFilterWhere(['like', 't2.service_programme', $this->service_id]);
$query->andFilterWhere(['LIKE', 'img_remarks', $this->img_remarks]);
return $dataProvider;
}
}