public function printData($id) { $transaksi = Transaksi::where('kode', $id)->firstOrFail(); $angsuran = Angsuran::where('kode', $id)->orderBy('created_at', 'desc')->firstOrFail(); $pdf = PDF::loadView('laporan.index', compact('angsuran', 'transaksi')); return $pdf->stream(); }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Transaksi::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' => $this->id, 'tanggal' => $this->tanggal, 'id_pelanggan' => $this->id_pelanggan, 'id_teknisi' => $this->id_teknisi]); return $dataProvider; }
/** * @return \yii\db\ActiveQuery */ public function getTransaksis() { return $this->hasMany(Transaksi::className(), ['id_pelanggan' => 'id_pelanggan']); }
/** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroy($id, $idtransaksi) { Transaksi::findOrFail($idtransaksi)->delete(); return redirect('admin/debitur/' . $id); }
protected function findModel($id) { if (($model = Transaksi::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
/** * @return \yii\db\ActiveQuery */ public function getTransaksis() { return $this->hasMany(Transaksi::className(), ['id_teknisi' => 'id']); }
/** * @return \yii\db\ActiveQuery */ public function getTransaksi() { return $this->hasOne(Transaksi::className(), ['id' => 'transaksi_id']); }