| Current Path : /var/www/html/ekursus/backend/models/ |
| Current File : /var/www/html/ekursus/backend/models/ReportTableSearch.php |
<?php
namespace backend\models;
use Yii;
use yii\base\Model;
use yii\data\ActiveDataProvider;
use backend\models\ReportTable;
/**
* ReportTableSearch represents the model behind the search form about `backend\models\ReportTable`.
*/
class ReportTableSearch extends ReportTable
{
/**
* @inheritdoc
*/
public function rules()
{
return [
[['id_report_table', 'id_report_meta'], 'integer'],
[['title_report_table', 'table_name', 'column_name', 'sql_statement', 'type_report', 'created_by', 'created_at', 'updated_by', 'updated_at','column_id'], '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 = ReportTable::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([
'id_report_table' => $this->id_report_table,
'id_report_meta' => $this->id_report_meta,
'column_id' => $this->column_id,
]);
$query->andFilterWhere(['like', 'title_report_table', $this->title_report_table])
->andFilterWhere(['like', 'table_name', $this->table_name])
->andFilterWhere(['like', 'column_name', $this->column_name])
->andFilterWhere(['like', 'sql_statement', $this->sql_statement])
->andFilterWhere(['like', 'type_report', $this->type_report])
->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]);
return $dataProvider;
}
}