示例#1
0
 public function showEditProduct($productID)
 {
     $userLogin = Auth::user();
     $productinformation = productinformation::with('getSubCategoryName')->with('getChild')->with('getStatus')->where('store_id', '=', $userLogin->login_id)->where('id', '=', $productID)->get();
     if (count($productinformation) == '0') {
         return redirect('/HMadmin/Main-Products');
     } else {
         $variants = variants::all();
         $brand = brand::all();
         $category = category::all();
         $sub_category = subcategory::all();
         $market = market::all();
         $tags = tags::where('product_info_id', '=', $productID)->get();
         $product_status = indicator::where('indicator_for', '=', 'PRODUCT STATUS')->get();
         $price_status = indicator::where('indicator_for', '=', 'PRODUCT PRICE')->get();
         $storeowner = storeowner::where('store_id', '=', $userLogin->login_id)->with('showStoreInfo')->get();
         $brand = brand::all();
         return view('admin.products.editproduct')->with('userinfo', $storeowner)->with('market_info', $market)->with('category_info', $category)->with('variants', $variants)->with('brand_info', $brand)->with('product_status', $product_status)->with('sub_cat', $sub_category)->with('brand_info', $brand)->with('price_status', $price_status)->with('tags', $tags)->with('productinformation', $productinformation);
     }
 }
示例#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::all();
                             $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 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);
                         } 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) {
     }
 }