| Current Path : /var/www/html/blupointz/backend/modules/registeredUser/models/ |
| Current File : /var/www/html/blupointz/backend/modules/registeredUser/models/RegisteredUserSearch.php |
<?php
namespace backend\modules\registeredUser\models;
use yii\base\Model;
use yii\data\ActiveDataProvider;
use backend\modules\registeredUser\models\RegisteredUser;
/**
* RegisteredUserSearch represents the model behind the search form of `backend\modules\registeredUser\models\RegisteredUser`.
*/
class RegisteredUserSearch extends RegisteredUser {
public $fullphoneno;
/**
* {@inheritdoc}
*/
public function rules() {
return [
[['registered_user_id', 'registered_user_status'], 'integer'],
[['fullphoneno', 'registered_user_name', 'registered_user_pwd', 'registered_user_phone_code', 'registered_user_phone_no', 'registered_user_email', 'registered_user_role', 'created_by', 'created_at', 'updated_by', 'updated_at'], 'safe'],
];
}
/**
* {@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 = RegisteredUser::find();
// add conditions that should always apply here
$dataProvider = new ActiveDataProvider(['query' => $query, 'pagination' => ['pageSize' => 10,]]);
$dataProvider->setSort(['defaultOrder' => ['registered_user_id' => 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([
'registered_user_id' => $this->registered_user_id,
'registered_user_status' => $this->registered_user_status,
]);
$query->andFilterWhere(['like', 'registered_user_name', $this->registered_user_name])
->andFilterWhere(['like', 'registered_user_pwd', $this->registered_user_pwd])
->andFilterWhere(['like', 'registered_user_email', $this->registered_user_email])
->andFilterWhere(['like', 'registered_user_role', $this->registered_user_role])
->andFilterWhere(['like', 'created_by', $this->created_by])
->andFilterWhere(['like', 'updated_by', $this->updated_by]);
$query->andFilterWhere(['like', 'created_at', $this->created_at]);
$query->andFilterWhere(['OR',
['like', 'registered_user_phone_code', $this->fullphoneno],
['like', 'registered_user_phone_no', $this->fullphoneno],
['like', 'CONCAT(registered_user_phone_code,"",registered_user_phone_no)', $this->fullphoneno]
]);
return $dataProvider;
}
}