/**
  * Show the application dashboard to the user.
  *
  * @return Response
  */
 public function showProductDetails($pid, $product_name)
 {
     if (ProductInfo::where('id', '=', $pid)->where('product_status', '=', '9')->exists()) {
         $ProductInfo = ProductInfo::with('product')->with('store')->with('productVariantGroup')->with('productVariant')->where('id', '=', $pid)->get();
         $fb_seo_meta = array();
         foreach ($ProductInfo as $info) {
             $name = $info->product_name;
             $store_name = $info->store->store_name;
             $store_id = $info->store->id;
             $sub_category_id = $info->sub_category_id;
             $fb_seo_meta['title'] = $store_name . ' - ' . $info->product_name;
             $fb_seo_meta['description'] = $info->product_description;
             foreach ($info->product as $piid) {
                 $product_id = $piid->id;
                 break;
             }
             break;
         }
         if (ProductInfo::where('id', '=', $pid)->where('product_name', '=', decodeUrlRoute($product_name))->exists()) {
             $market_data = Market::with('category')->get();
             $listFiles = [];
             $files = \File::files('assets/img/store/' . $store_name . '/product/' . $product_id);
             foreach ($files as $path) {
                 $listFiles[] = pathinfo($path);
             }
             $fb_seo_meta['image'] = 'assets/img/noimage.png';
             foreach ($listFiles as $seo_img) {
                 $fb_seo_meta['image'] = $seo_img['dirname'] . '/' . $seo_img['basename'];
                 break;
             }
             $store_market_data = Market::with(['category' => function ($query) use($store_id) {
                 $query->whereHas('subCategory', function ($q) use($store_id) {
                     $q->where('store_id', '=', $store_id)->groupBy('category_id');
                 });
             }])->get();
             if (Auth::check()) {
                 $id = Auth::user()->login_id;
                 $user = User::where('id', $id)->with('member')->get();
                 return view('client.pages.product-details')->with('user', $user)->with('market_data', $market_data)->with('store_market_data', $store_market_data)->with('ProductInfo', $ProductInfo)->with('ImageFiles', $listFiles)->with('OtherFiles', $listFiles)->with('fb_seo_meta', $fb_seo_meta);
             } else {
                 return view('client.pages.product-details')->with('market_data', $market_data)->with('store_market_data', $store_market_data)->with('ProductInfo', $ProductInfo)->with('ImageFiles', $listFiles)->with('OtherFiles', $listFiles)->with('fb_seo_meta', $fb_seo_meta);
                 //return $listFiles;
             }
         } else {
             return redirect('/Product/Details/' . $pid . '/' . encodeUrlRoute($name));
         }
     } else {
         return redirect('/Market');
     }
 }