Пример #1
0
 public function printItems($id)
 {
     $checkout = Checkout::with('user', 'orders', 'orders.product', 'area')->findOrFail($id);
     //dd($checkout);
     $html = '<p>Order No: ' . $checkout->id . '</p>' . '<p>Customer Name: ' . $checkout->user->name . '</p>' . '<p>Phone: ' . $checkout->user->mobile . '</p>' . '<p>Address: ' . $checkout->user->address . '</p>' . '<p>Area: ' . $checkout->area->area_name . '</p>' . '<div><table>' . '<tr>' . '<th>Product Name</th>' . '<th>Quantity</th>' . '<th>Nos</th></tr>';
     foreach ($checkout->orders as $order) {
         $html .= '<tr>' . '<td>' . $order->product->product_name . '</td>' . '<td>' . $order->pqty . '</td>' . '<td>' . $order->nos . '</td>' . '</tr>';
     }
     $html .= '</table></div>';
     //dd($html);
     return PDF::loadHTML($html)->stream();
 }
Пример #2
0
 public function orderdetail($id)
 {
     $checkout = Checkout::with('orders', 'orders.product')->findorfail($id);
     return view('site.myorderdetail', compact('checkout'));
 }