/**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function ApiIndexAction()
 {
     $cakes = DB::table('categories')->select('categories.id as category_id', 'categories.name as category_name', 'categories.per_pound_price', 'products.id as product_id', 'products.name as product_name', 'products.starting_pound', 'products.price', 'products.ending_pound', 'products.description as description', 'products.is_active')->leftJoin('category_product', 'category_product.category_id', '=', 'categories.id')->leftJoin('products', 'products.id', '=', 'category_product.product_id')->where('categories.parent_id', 1)->where('products.is_active', 1)->get();
     $Accessories = DB::table('categories')->select('categories.id as category_id', 'categories.name as category_name', 'categories.per_pound_price', 'products.id as product_id', 'products.name as product_name', 'products.starting_pound', 'products.price', 'products.ending_pound', 'products.description as description', 'products.is_active')->leftJoin('category_product', 'category_product.category_id', '=', 'categories.id')->leftJoin('products', 'products.id', '=', 'category_product.product_id')->where('categories.parent_id', 2)->where('products.is_active', 1)->get();
     $gift = DB::table('categories')->select('categories.id as category_id', 'categories.name as category_name', 'categories.per_pound_price', 'products.id as product_id', 'products.name as product_name', 'products.starting_pound', 'products.price', 'products.ending_pound', 'products.description as description', 'products.is_active')->leftJoin('category_product', 'category_product.category_id', '=', 'categories.id')->leftJoin('products', 'products.id', '=', 'category_product.product_id')->where('categories.parent_id', 3)->where('products.is_active', 1)->get();
     $offers = categories::select('name as category_name', 'short_description', 'detail_description', 'per_pound_price')->where('parent_id', 4)->where('is_active', 1)->get();
     $array_set = array('Cakes' => $cakes, 'Accessories' => $Accessories, 'Gift' => $gift, 'Offers' => $offers);
     $result = Response::json(array('result' => $array_set))->header('Content-Type', 'application/json');
     return $result;
 }
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int $id
  * @return \Illuminate\Http\Response
  */
 public function edit($id)
 {
     $gift = categories::find($id);
     $p_category = categories::select('id', 'name', 'parent_id')->where('parent_id', 0)->get();
     return view('admin/category/gift/gift_edit', compact('gift', 'p_category'));
 }
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int $id
  * @return Response
  */
 public function EditAction($id)
 {
     $products = products::find($id);
     $n_category = categories::select('id', 'name', 'parent_id')->where('parent_id', 5)->get();
     $cakes = categories::select('id', 'name')->where('parent_id', 1)->get();
     return view('admin/product/cake/product_cake_edit', compact('products', 'cakes', 'n_category'));
 }
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int $id
  * @return Response
  */
 public function edit($id)
 {
     $parent_category_layout = $this->parent_category_layout;
     $products = products::find($id);
     $category = categories::select('id', 'name')->where('parent_id', 3)->get();
     return view('admin/product/gift/product_gift_edit', compact('products', 'category', 'parent_category_layout'));
 }
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $flavors = categories::select('id', 'name', 'per_pound_price', 'is_active')->where('parent_id', 1)->orderBy('id', 'asc')->get();
     return view('admin/category/flavor/flavor_list', compact('flavors'));
 }
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int $id
  * @return \Illuminate\Http\Response
  */
 public function edit($id)
 {
     $offers = categories::findorfail($id);
     $p_category = categories::select('id', 'name', 'parent_id')->where('parent_id', 0)->get();
     return view('admin/category/offers/offers_edit', compact('offers', 'p_category'));
 }
 public function __construct()
 {
     $this->parent_category_layout = categories::select('id', 'name')->where('parent_id', 0)->get();
 }