public function update($id, FinesRequest $request) { $fines = Fine::findOrFail($id); $input = $request->all(); $fines->update($input); session()->flash('flash_message', 'You have been updated fines!'); return redirect()->route('settings.fines'); }
public function laporan() { $tglSekarang = time(); $transactions = Transaction::with('student', 'book')->notReturnedYet()->get(); foreach ($transactions as $transaction) { $dateDiff = $tglSekarang - $transaction['borrowed_at']; $durasi = floor($dateDiff / (60 * 60 * 24)); $fines = Fine::first(); if ($durasi > $fines['days']) { $hariDenda = $durasi - $fines['days']; $denda = $hariDenda * $fines['fines']; $transaction->update(['fines' => $denda]); } else { $denda = 0; $transaction->update(['fines' => $denda]); } } //ambil tanggal //$date2 = mktime(0,0,0,05,31,2015); //return $date2; return view('lms.peminjaman.laporan', compact('transactions', 'durasi')); }