public function View_order_details($order_id, $user_id) { $parent_category_layout = $this->parent_category_layout; $user_information = userRegister::select('full_name')->where('id', $user_id)->first(); $orders = orders::with('order_details')->select('id', 'user_id', '_token', 'order_date', 'total')->where('id', $order_id)->first(); $orders['user_index'] = $user_information; foreach ($orders->order_details as $key => $order) { $orders->order_details[$key]['product_name'] = products::select('name')->where('id', $order->product_id)->first(); } return view('admin/order_details/view_order_details', compact('parent_category_layout', 'orders')); }
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function DeleteAction($id) { $product = products::find($id); if ($product) { foreach ($product->image as $img) { @unlink(public_path() . '/images/' . $img->path); $img->delete(); } $product->delete(); return redirect()->route('cake/list')->with('message', Lang::get('response.CUSTOM_MESSAGE_SUCCESS', ['message' => 'The product table item has been successfully deleted'])); } return redirect()->route('cake/list')->with('message', Lang::get('response.CUSTOM_MESSAGE_ALERT', ['message' => 'The product table item can not delete'])); }
public function AccessoriesApi() { $details = products::select('products.id', 'products.name as product_name', 'images.path', 'images.caption')->leftJoin('image_product', 'image_product.product_id', '=', 'products.id')->leftJoin('images', 'images.id', '=', 'image_product.image_id')->leftJoin('category_product', 'category_product.product_id', '=', 'products.id')->leftJoin('categories', 'categories.id', '=', 'category_product.category_id')->where('categories.id', 2)->get(); $result = Response::json(array('result' => $details))->header('Content-Type', 'application/json'); return $result; }
/** Get Product id and find image id*/ public function ManageOption($id) { $parent_category_layout = $this->parent_category_layout; $product = products::find($id); return view('admin/image/image_manage', compact('product', 'parent_category_layout')); }