surat/frontend/modules/administrator/models/CenterApproveSearch.php

83 lines
2.4 KiB
PHP

<?php
namespace frontend\modules\administrator\models;
use yii\base\Model;
use yii\data\ActiveDataProvider;
use common\models\CenterApprove;
/**
* CenterApproveSearch represents the model behind the search form of `common\models\CenterApprove`.
*/
class CenterApproveSearch extends CenterApprove
{
/**
* {@inheritdoc}
*/
public function rules()
{
return [
[['id', 'is_send_request', 'is_express', 'pathologist_id', 'cytotech1_id', 'cytotech1_at', 'ref_id', 'approve_status', 'release_by', 'approve_by'], 'integer'],
[['id_case', 'send_request_at', 'report_type', 'release_at', 'approve_at', 'remark'], '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 = CenterApprove::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' => $this->id,
'is_send_request' => $this->is_send_request,
'is_express' => $this->is_express,
'pathologist_id' => $this->pathologist_id,
'cytotech1_id' => $this->cytotech1_id,
'cytotech1_at' => $this->cytotech1_at,
'ref_id' => $this->ref_id,
'send_request_at' => $this->send_request_at,
'approve_status' => $this->approve_status,
'release_by' => $this->release_by,
'release_at' => $this->release_at,
'approve_by' => $this->approve_by,
'approve_at' => $this->approve_at,
]);
$query->andFilterWhere(['like', 'id_case', $this->id_case])
->andFilterWhere(['like', 'report_type', $this->report_type])
->andFilterWhere(['like', 'remark', $this->remark]);
return $dataProvider;
}
}