| Current Path : /var/www/html/school/backend/models/ |
| Current File : /var/www/html/school/backend/models/AdmDaerahKecilSearch.php |
<?php
namespace backend\models;
use Yii;
use yii\base\Model;
use yii\data\ActiveDataProvider;
use backend\models\AdmDaerahKecil; //masukkan nama model tanpa .php atau nama class model
/**
* Ubah nama kelas mengikut nama class model
* AdmNegaraSearch represents the model behind the search form of `backend\models\ContentFaq`.
*/
class AdmDaerahKecilSearch extends AdmDaerahKecil
{
/**
* masukkan nama bidang table db
* @inheritdoc
*/
public function rules()
{
return [
[['id_daerah_kecil','aktif'], 'integer'],
[['kod_daerah_kecil','daerah_kecil','created_date','created_by','modified_by','modified_date','kod_daerah','kod_negara','kod_negeri'], 'safe'],
];
}
/**
* @inheritdoc
*/
public function scenarios()
{
// bypass scenarios() implementation in the parent class
return Model::scenarios();
}
/**
* Ubah atau tambah pada $this-> bidang yang anda hendak masukkan dalam pencarian
* Creates data provider instance with search query applied
*
* @param array $params
*
* @return ActiveDataProvider
*/
public function search($params)
{
$query = AdmDaerahKecil::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_daerah_kecil' => $this->id_daerah_kecil,
'kod_daerah_kecil' => $this->kod_daerah_kecil,
'daerah_kecil' => $this->daerah_kecil,
'kod_negara' => $this->kod_negara,
'kod_negeri' => $this->kod_negeri,
'kod_daerah' => $this->kod_daerah,
'created_at' => $this->created_date,
'created_by' => $this->created_by,
'updated_at' => $this->modified_date,
'updated_by' => $this->modified_by,
]);
return $dataProvider;
}
}