Example #1
0
 private function getCategories()
 {
     $brands = Brands::all();
     return $brands;
     $consumer_key = 'b64350b6b45c8fed49aa9983bf197844';
     $consumer_secret = '85b3ce2964a63c8fb07d868a58f13b69';
     $oauth_token = 'd5608ad8dbd007c0d5cd10688e7d428d';
     $oauth_secret = '9f11ac72c96ffd96a00ee58cf67b2d2a';
     $client = new \OAuth($consumer_key, $consumer_secret, OAUTH_SIG_METHOD_HMACSHA1, OAUTH_AUTH_TYPE_AUTHORIZATION);
     $client->enableDebug();
     $client->setToken($oauth_token, $oauth_secret);
     try {
         $client->fetch('http://local.giftbig.com/rest/catalog', '', OAUTH_HTTP_METHOD_GET, ['Content-Type' => 'application/json', 'Accept' => '*/*']);
         $result = $client->getLastResponse();
         $result = json_decode($result);
         return $result->_embedded->products;
     } catch (\Exception $e) {
         return [];
     }
 }
 /**
  * Show the application dashboard to the user.
  *
  * @return Response
  */
 public function showMarket()
 {
     $fb_seo_meta = array();
     $fb_seo_meta['title'] = 'HomemallPH';
     $fb_seo_meta['description'] = 'HomemallPH - Convenience at your doorstep!';
     $fb_seo_meta['image'] = 'asset/img/homemalllogo.jpg';
     $market_data = Market::with('categoryStore')->orderBy('id')->get();
     $featured_products = FeaturedProducts::with('product_info')->where('store_id', '=', '0')->get();
     $featured_store = FeaturedStore::with('store')->get();
     $featured_category = FeaturedCategory::with('categoryProduct')->with('category')->get();
     $featured_trend = FeaturedTrend::with('product_info')->get();
     $brands = Brands::all();
     if (Auth::check()) {
         $id = Auth::user()->login_id;
         $user = User::where('id', $id)->with('member')->get();
         return view('client.pages.market')->with('user', $user)->with('market_data', $market_data)->with('brands_data', $brands)->with('featured_products', $featured_products)->with('featured_store', $featured_store)->with('featured_category', $featured_category)->with('featured_trend', $featured_trend)->with('fb_seo_meta', $fb_seo_meta);
     } else {
         return view('client.pages.market')->with('market_data', $market_data)->with('brands_data', $brands)->with('featured_products', $featured_products)->with('featured_store', $featured_store)->with('featured_category', $featured_category)->with('featured_trend', $featured_trend)->with('fb_seo_meta', $fb_seo_meta);
         //return $items;
     }
 }
 public function update(BrandsRequest $request, $id)
 {
     $brand = Brands::find($id);
     $brand->name = $request->get('name');
     $brand->description = $request->get('description');
     if (Input::hasFile('image') && Input::file('image')->isValid()) {
         $path = public_path() . '/images/brands/' . $id . '/';
         if (!is_dir($path)) {
             mkdir($path);
         }
         $destination_path = $path;
         $extension = Input::file('image')->getClientOriginalExtension();
         $file_name = 'brands_' . $id . '.' . $extension;
         $upload_success = Input::file('image')->move($destination_path, $file_name);
         if ($upload_success) {
             $brand->image = '/images/brands/' . $id . '/' . $file_name;
         }
     }
     $brand->save();
     return redirect()->route('brands');
 }
Example #4
0
 /**
  * Remove a Brand from storage
  * @param $id
  * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
  */
 public function destroyBrand($id)
 {
     Brands::where('id', $id)->delete();
     Session::flash('success_message', 'Brand has been deleted from database');
     return redirect('config');
 }
Example #5
0
 /**
  * Display list of brands from storage
  * @return static
  */
 public function brand()
 {
     return Brands::all()->lists('brand', 'brand')->sortBy('brand');
 }
Example #6
0
 public function getBrandByID($brandId)
 {
     $brands = Brands::where('id', $brandId)->get();
     return $brands;
 }
Example #7
0
 public function getBrandModelByID($modelID)
 {
     $brands = new Brands();
     $data = $brands->getBrandModelByID($modelID);
     return response()->json($data);
 }
Example #8
0
 private function findBrandBySVName($brand_sv)
 {
     return Brands::where('sv_name', $brand_sv)->get()->first();
 }
 public function getModels(Request $request)
 {
     if (Auth::user()->email == '*****@*****.**') {
         $brands = Brands::all();
         $models = DB::table('models')->where('in_brand', $request->input('brand-id'))->orderBy('position', 'asc')->get();
         return view('admin.models')->with('brands', $brands)->with('models', $models);
     }
     return redirect('/');
 }
 private function getBrand($brand_slug)
 {
     return Brands::where('slug', $brand_slug)->get()->first();
 }
 public function searchProducts(Request $request)
 {
     $query = $request->input('search-query');
     if ($query == '') {
         return redirect('/');
     }
     if ($request->input('model') == '') {
         $products = Products::where(DB::raw("name"), 'LIKE', "%{$query}%")->paginate(18);
         $products->setPath('/search?search-query=' . $query);
     } else {
         $products = Products::where(DB::raw("name"), 'LIKE', "%{$query}%")->where('model', $request->input('model'))->paginate(18);
         $products->setPath('/search?search-query=' . $query . '&model=' . $request->input('model'));
     }
     $brands = Brands::all();
     $models = Models::all();
     $productImages = DB::table('product_images')->get();
     $count = 0;
     // making clearfix for latest products
     return view('pages.search-results')->with('query', $query)->with('products', $products)->with('query', $query)->with('brands', $brands)->with('models', $models)->with('productImages', $productImages)->with('count', $count);
 }
 public function persistAndRetrieveBrandEntry($requestBody)
 {
     return Brands::firstOrCreate(["name" => $requestBody->brand]);
 }