/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = TipeKendaraan::find(); $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; } $query->andFilterWhere(['id_tipe' => $this->id_tipe]); $query->andFilterWhere(['like', 'nama_tipe', $this->nama_tipe]); return $dataProvider; }
public static function tipeKendaraan() { $listData = ArrayHelper::map(TipeKendaraan::find()->all(), 'id_tipe', 'nama_tipe'); return $listData; }