Ejemplo n.º 1
0
 /**
  * показываем список транзакций за указанную дату для текущего пользователя
  *
  * @return \Illuminate\Http\Response
  */
 public function getList($date = '')
 {
     $date = $date ?: date("Y-m-d");
     $start = \Carbon::createFromFormat("Y-m-d", $date)->startOfDay()->toDateTimeString();
     $end = \Carbon::createFromFormat("Y-m-d", $date)->endOfDay()->toDateTimeString();
     //
     return ['content' => Transaction::with('card')->where('user_id', $this->user->id)->where('created_at', '>=', $start)->where('created_at', '<=', $end)->orderBy('created_at', 'DESC')->get()];
 }
 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'));
 }
Ejemplo n.º 3
0
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function show($id)
 {
     $order = Transaction::get_order($id);
     $id_product = $order->id_product;
     $transaction = Transaction::with('user')->where('id', '=', $id)->first();
     $id_user = $transaction->id_user;
     $products = Transaction::get_product($id);
     $profile = Profile::where('id_user', '=', $id_user)->first();
     return view('cart.final', compact('profile', 'transaction', 'products'));
 }
 public function management_subscribe()
 {
     $transactions = Transaction::with('user')->orderBy('id', 'desc')->where('subsribe_status', 'active')->get();
     $data['header'] = 'transaction management';
     return view('transaction.management_subsribe', compact('transactions'), $data);
 }