Example #1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Pelanggan::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_pelanggan' => $this->id_pelanggan]);
     $query->andFilterWhere(['like', 'nama', $this->nama])->andFilterWhere(['like', 'alamat', $this->alamat])->andFilterWhere(['like', 'telp', $this->telp])->andFilterWhere(['like', 'tipe_kendaraan', $this->tipe_kendaraan])->andFilterWhere(['like', 'no_polisi', $this->no_polisi]);
     return $dataProvider;
 }
Example #2
0
 public function getTransaksis()
 {
     return $this->hasMany(Pelanggan::className(), ['id_tipe' => 'tipe_kendaraan']);
 }
 public function actionGetPelanggan()
 {
     $pelanggan = Pelanggan::find()->asArray()->all();
     return json_encode($pelanggan);
 }
Example #4
0
 /**
  * Finds the Pelanggan model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Pelanggan the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Pelanggan::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Example #5
0
 public function KodePelanggan()
 {
     $listData = ArrayHelper::map(Pelanggan::find()->all(), 'id_pelanggan', 'nama');
     return $listData;
 }