app/Http/Controllers/OrderController.php
/**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
Display a listing of the resource.
@return \Illuminate\Http\Response
Display a listing of the resource . @return \ Illuminate \ Http \ Response
public function index()
    {
        $products=Product::all();
        $orders=Order::all();
         last order detail name and phone no 
        $lastOrder=Order::max('id');
        $nameoforder=Order::where('id', $lastOrder)->get();
        last order_detail details
        $lastID = Order_Detail::max('order_id');
        $order_receipt = Order_Detail::where('order_id',$lastID)->get();
        return view('orders.index',[
            'orders'=>$orders,
            'products'=>$products,
            'order_receipt'=>$order_receipt,
            'nameoforder'=>$nameoforder
        ]);
    }
public function index ( ) { $ products = Product :: all ( ) ; $ orders = Order :: all ( ) ; $ lastOrder = Order :: max ( 'id' ) ; $ nameoforder = Order :: where ( 'id' , $ lastOrder ) -> get ( ) ; return view ( 'orders.index' , [ 'orders' => $ orders , 'products' => $ products , 'nameoforder' => $ nameoforder ] ) ; }
Display a listing of the resource.
Display a listing of the resource .
// // last order detail name and phone no  //last order_detail details //$lastID = Order_Detail::max('order_id'); //$order_receipt = Order_Detail::where('order_id',$lastID)->get(); //'order_receipt'=>$order_receipt,