public function BillDetail($bill_id)
 {
     if (Auth::check()) {
         $billInfo = Bill::find($bill_id);
         if ($billInfo->customer_id == Auth::user()->id) {
             $customerInfo = CustomerInfo::getAddressInfo($billInfo->customer_info_id);
             $billDetail = billDetail::getProducts($bill_id);
             return view("pages.finish_purchase", compact("billInfo", "customerInfo", "billDetail"));
         } else {
             return redirect()->route("home");
         }
     } else {
         return redirect()->route("login");
     }
 }
 public function DetailBill(Request $request, $billId)
 {
     if ($request->ajax()) {
         $detail = billDetail::getProducts($billId);
         $string = "";
         foreach ($detail as $item) {
             $string = "<td>" . $item->products_id . "</td>";
             $string .= "<td>" . $item->name . "</td>";
             $string .= "<td>" . $item->amount . "</td>";
             $string .= "<td>" . $item->price . "</td>";
         }
         return json_encode(["result" => $string]);
     }
 }
示例#3
0
 public static function getProducts($billID)
 {
     $billDetail = billDetail::join("products", "products.id", "=", "bill_details.products_id")->select(["products.name", "bill_details.*"])->where("bill_details.bill_id", $billID)->get();
     return $billDetail;
 }