Exemplo n.º 1
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function edit($id)
 {
     if (Auth::check()) {
         if (Auth::user()->role == 'admin') {
             $products = \App\Order_Product::query()->join('product', 'order_product.product_id', '=', 'product.id')->select('order_product.*', 'product.*')->where('order_product.order_id', $id)->get();
             $order = \App\Order::where('order_id', $id)->first();
             return view('order.edit', compact('products', 'order'));
         }
     } else {
         return view('errors.unauthorized');
     }
 }