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')); }
/** * Display a listing of the resource. * * @return Response */ public function IndexAction() { /* */ /** * Data for offers via category. */ /* DB::raw('GROUP_CONCAT(DISTINCT categories.name) as flavor_name'))*/ $details = products::select('products.id', 'products.name as product_name', 'products.is_active', 'products.starting_pound', 'products.ending_pound', 'products.price')->leftJoin('category_product', 'category_product.product_id', '=', 'products.id')->leftJoin('categories', 'categories.id', '=', 'category_product.category_id')->where('categories.parent_id', 5)->get(); foreach ($details as $key => $det) { $details[$key]['category_name'] = categories::select('categories.id', 'categories.name as category_name')->leftJoin('category_product', 'category_product.category_id', '=', 'categories.id')->leftJoin('products', 'products.id', '=', 'category_product.product_id')->where('categories.parent_id', 5)->where('products.id', '=', $det->id)->get()->toArray(); $details[$key]['flavor'] = categories::select('categories.id', 'categories.name as flavor')->leftJoin('category_product', 'category_product.category_id', '=', 'categories.id')->leftJoin('products', 'products.id', '=', 'category_product.product_id')->where('categories.parent_id', 1)->where('products.id', '=', $det->id)->get()->toArray(); } $offers = categories::select('id', 'name')->where('parent_id', 4)->get(); return view('admin/product/cake/product_cake_list', compact('details', 'cake_flavor', 'offers')); }
/** * Display a listing of the resource. * * @return Response */ public function index() { $offers = categories::select('id', 'name')->where('parent_id', 4)->get(); $gifts = products::select('products.id', 'products.name', 'products.is_active', 'products.price')->leftJoin('category_product', 'category_product.product_id', '=', 'products.id')->leftJoin('categories', 'categories.id', '=', 'category_product.category_id')->where('categories.parent_id', 3)->paginate($this->product_pagination); return view('admin/product/gift/product_gift_list', compact('gifts', 'offers')); }
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; }