/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = TransaksiBeli::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(['tgl_beli' => $this->tgl_beli, 'id_supplier' => $this->id_supplier, 'id_barang' => $this->id_barang, 'jumlah_beli' => $this->jumlah_beli, 'harga_beli' => $this->harga_beli]); $query->andFilterWhere(['like', 'id_beli', $this->id_beli]); return $dataProvider; }
/** * @return \yii\db\ActiveQuery */ public function getTransaksiBelis() { return $this->hasMany(TransaksiBeli::className(), ['id_supplier' => 'id_supplier']); }
/** * Finds the TransaksiBeli model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param string $id * @return TransaksiBeli the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = TransaksiBeli::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }