| Current Path : /var/www/html/chatbot/backend/models/ |
| Current File : /var/www/html/chatbot/backend/models/ReportMetaSearch.php |
<?php
namespace backend\models;
use Yii;
use yii\base\Model;
use yii\data\ActiveDataProvider;
use backend\models\ReportMeta;
/**
* ReportMetaSearch represents the model behind the search form about `backend\models\ReportMeta`.
*/
class ReportMetaSearch extends ReportMeta
{
/**
* @inheritdoc
*/
public function rules()
{
return [
[['title_report_meta', 'created_by', 'created_at', 'updated_by', 'updated_at','role','display_dashboard'], '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 = ReportMeta::find();
// add conditions that should always apply here
$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;
}
// grid filtering conditions
$query->andFilterWhere(['like', 'title_report_meta', $this->title_report_meta])
->andFilterWhere(['like', 'created_by', $this->created_by])
->andFilterWhere(['like', 'created_at', $this->created_at])
->andFilterWhere(['like', 'updated_by', $this->updated_by])
->andFilterWhere(['like', 'updated_at', $this->updated_at])
->andFilterWhere(['like', 'role', $this->role])
->andFilterWhere(['like', 'display_dashboard', $this->display_dashboard]);
return $dataProvider;
}
}