示例#1
0
 public function checkSubcatNameExist($category_id, $sub_catname)
 {
     try {
         $ifExist = subcategory::where('category_id', '=', $category_id)->where('sub_category_name', $sub_catname)->get();
         //$ifExist = subcategory::where('category_id','=','1')->where('sub_category_name','=','Office Partition')->get();
         // return  $ifExist;
         if (count($ifExist) <= 0) {
             return '0';
             //no data
         } else {
             return '1';
             //with data
         }
     } catch (\Exception $e) {
         return '0';
     }
 }
示例#2
0
 public function showProducts(Request $request)
 {
     try {
         //return $this->checkUserLevel();
         if ($request->isMethod('GET')) {
             if ($this->checkUserLevel() == 'authFailed') {
                 return redirect('/HMadmin/login');
             } else {
                 if ($this->checkUserLevel() == 'authErr') {
                     return redirect('/HMadmin/login');
                 } else {
                     if ($this->checkUserLevel() == 'empty') {
                         return 'no indicator';
                     } else {
                         foreach ($this->checkUserLevel() as $indicatorInfo) {
                             $indicator_id = $indicatorInfo->id;
                             $indicator_name = $indicatorInfo->indicator_name;
                             $indicator_for = $indicatorInfo->indicator_for;
                         }
                         if ($indicator_name == 'STORE ADMIN') {
                             $userLogin = Auth::user();
                             $storeowner = storeowner::where('store_id', '=', $userLogin->login_id)->with('showStoreInfo')->get();
                             $category = category::all();
                             $sub_category = subcategory::where('store_id', '=', $userLogin->login_id)->orWhere('store_id', '=', '0')->get();
                             $productinformation = productinformation::where('store_id', '=', $userLogin->login_id)->get();
                             $brand = brand::all();
                             $market = market::all();
                             $variants = variants::all();
                             $indicator = indicator::where('indicator_for', '=', 'PRODUCT STATUS')->get();
                             $product_status = indicator::where('indicator_for', '=', 'PRODUCT PRICE')->get();
                             //return json_encode($productinformation);
                             return view('admin.products.products')->with('userLevel', $indicator_name)->with('userinfo', $storeowner)->with('market_info', $market)->with('category_info', $category)->with('sub_cat', $sub_category)->with('indicator', $indicator)->with('product_status', $product_status)->with('variants', $variants)->with('brand_info', $brand)->with('productinformation', $productinformation);
                         } else {
                             $userLogin = Auth::user();
                             $storeowner = storeowner::where('store_id', '=', $userLogin->login_id)->with('showStoreInfo')->get();
                             return view('admin.products.products')->with('userLevel', $indicator_name)->with('userinfo', $storeowner);
                         }
                     }
                 }
             }
         } else {
             //err method err
         }
     } catch (\Exception $e) {
     }
 }