示例#1
0
 public function getHistorico()
 {
     $sale = Transaction::whereHas('book', function ($q) {
         $q->where('id_user', '=', \Auth::user()->id);
     })->get();
     $sale->sum('price');
     $myRental = Aluguer::whereHas('book', function ($q) {
         $q->where('id_user', '=', \Auth::user()->id);
     })->get();
     $purchases = Purchase::where('user_id', '=', \Auth::user()->id)->get();
     $rental = Aluguer::where('user_id', '=', \Auth::user()->id)->get();
     $user = \App\User::find(\Auth::user()->id);
     return view('historico', ['purchases' => $purchases, 'sales' => $sale, 'rentals' => $rental, 'myRentals' => $myRental, 'user' => $user]);
 }