/**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Barang::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->joinWith('idSupplier0');
     $query->andFilterWhere(['stok' => $this->stok, 'hpp' => $this->hpp, 'hj' => $this->hj, 'jual' => $this->jual]);
     $query->andFilterWhere(['like', 'id', $this->id])->andFilterWhere(['like', 'kode', $this->kode])->andFilterWhere(['like', 'warna', $this->warna])->andFilterWhere(['like', 'size', $this->size])->andFilterWhere(['like', 'toko', $this->toko])->andFilterWhere(['like', 'status', $this->status])->andFilterWhere(['like', 'supplier.nama', $this->idSupplier]);
     return $dataProvider;
 }
 /**
  * Finds the Barang model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param string $id
  * @return Barang the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Barang::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }