Your IP : 216.73.216.79


Current Path : /var/www/html/chatbot/backend/models/
Upload File :
Current File : /var/www/html/chatbot/backend/models/RosMakAjkSearch.php

<?php

namespace backend\models;

use Yii;
use yii\base\Model;
use yii\data\ActiveDataProvider;
use backend\models\RosMakAjk;  //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 RosMakAjkSearch extends RosMakAjk
{
    /**
     * masukkan nama bidang table db
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['id_ajk','id_penyata'], 'integer'],
            [['nama','ic','created_date','created_by','updated_by','updated_date','no_tel' , 'emel'], '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 = RosMakAjk::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_pt_bank' => $this->id_pt_bank,
            'no_pertubuhan' => $this->no_pertubuhan,
            'no_cawangan' => $this->no_cawangan,
            'id_penyata' => $this->id_penyata,
            'nama_bank' => $this->nama_bank,
            'nom_akaun' => $this->nom_akaun,
            'kod_status_permohonan' => $this->kod_status_permohonan,
            'created_at' => $this->created_date,
            'created_by' => $this->created_by,
            'updated_at' => $this->modified_date,
            'updated_by' => $this->modified_by,
        ]);*/

        $query->andFilterWhere(['like', 'nama', $this->nama])
            ->andFilterWhere(['like', 'ic', $this->ic])
            ->andFilterWhere(['like', 'id_penyata', $this->id_penyata])
            ->andFilterWhere(['like', 'no_tel', $this->no_tel])
            ->andFilterWhere(['like', 'emel', $this->emel]);

        return $dataProvider;
    }
}