���� JFIF fdasasfas213sdaf
Server IP : 147.79.69.51 / Your IP : 216.73.216.200 Web Server : LiteSpeed System : Linux in-mum-web669.main-hosting.eu 5.14.0-503.23.2.el9_5.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Feb 12 05:52:18 EST 2025 x86_64 User : u479334040 ( 479334040) PHP Version : 8.2.27 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /home/u479334040/domains/aluminiumplant.com/public_html/app/ |
Upload File : |
<?php class Helper { public static function get_countries() { $url = Helper::location_url()."public/api/get_countries"; $ch = curl_init(); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_URL, $url); $countries = json_decode(curl_exec($ch)); curl_close($ch); return $countries; } public static function get_filter_attributes($filter_id) { $sql = DB::table('add_filters')->where('filter_id',$filter_id)->get(); return $sql; } public static function post_data_to_api($payload,$api_key) { $api_url = "https://app.spherionsolutions.com/public/api/post_leads"; $curl = curl_init(); // You can also set the URL you want to communicate with by doing this: // $curl = curl_init('http://localhost/echoservice'); $header = array(); $header[] = 'Content-type: application/json'; $header[] = 'Authorization: '.$api_key; // We POST the data // Insert the data curl_setopt($curl, CURLOPT_POSTFIELDS, $payload); curl_setopt($curl, CURLOPT_HTTPHEADER, $header); // You can also bunch the above commands into an array if you choose using: curl_setopt_array curl_setopt($curl, CURLOPT_POST, 1); // Set the url path we want to call curl_setopt($curl, CURLOPT_URL, $api_url); // Make it so the data coming back is put into a string curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); // Send the request $result = curl_exec($curl); // Free up the resources $curl is using curl_close($curl); return $result; } public static function get_package_data($package_id) { $sql = DB::table('packages')->where('id',$package_id)->get(); return $sql; } public static function get_all_vendors() { $sql = DB::table('vendors')->get(); return $sql; } public static function get_lead_contact() { $sql = DB::table('contact')->get(); return $sql; } public static function get_lead_list_your_business() { $sql = DB::table('list_your_business')->get(); return $sql; } public static function get_popular_cities2() { $sql = DB::table('popular_cities')->get(); return $sql; } public static function get_packages() { $sql = DB::table('packages')->get(); return $sql; } public static function get_product_categories2() { $sql = DB::table('product_categories')->get(); return $sql; } public static function get_vendor_package_data() { $expiry_date = ""; $package_id = 0; $status = ""; foreach(Helper::get_vendor_details2() as $key => $value) { $expiry_date = $value->expiry_date; $status = $value->status; $package_id = $value->package_id; } $product_count = ""; $package_name = ""; foreach(Helper::get_package_data($package_id) as $key => $value) { $product_count = $value->product_count; $package_name = $value->package_name; } $data[] = array('product_count' => $product_count, 'package_name' => $package_name,'status' => $status,'expiry_date' => $expiry_date); return $data; } public static function get_filter_name($filter_id) { $sql = DB::table('filters')->where('id',$filter_id)->get(); $filter_name = ""; foreach($sql as $key => $value) { $filter_name = $value->title; } return $filter_name; } public static function get_filter_attribute_name($filter_id) { $sql = DB::table('add_filters')->where('id',$filter_id)->get(); $filter_name = ""; foreach($sql as $key => $value) { $filter_name = $value->title; } return $filter_name; } public static function get_filter_attributes2($product_id, $filter_id) { $sql = DB::table('product_filter_attribute')->where('product_id', $product_id)->where('filter_id', $filter_id)->get(); $filter_attributes = ""; foreach($sql as $key => $value) { $filter_attributes.= Helper::get_filter_attribute_name($value->filter_attribute_id).", "; } return rtrim($filter_attributes, ', ');; } public static function get_vendor_phone_number_by_userid($user_id) { $check = DB::table('users')->where('id', $user_id)->get(); $vendor_mobile = ""; foreach($check as $key => $value) { $vendor_mobile = $value->mobile; } return $vendor_mobile; } public static function get_review_parameters() { $sql = DB::table('review_parameters')->get(); return $sql; } public static function get_seller_products($user_id) { $sql = DB::table('products')->where('user_id', $user_id)->get(); return $sql; } public static function get_vendor_review($user_id) { $sql = DB::table('reviews')->where('vendor_user_id', $user_id)->orderBy('id','desc')->get(); return $sql; } public static function get_quote_lead() { $vendor_id = Helper::get_vendor_id_by_user_id(Auth::user()->id); $products = DB::table('products')->where('user_id',Auth::user()->id)->get(); $productids = array(); $productcategoryids = array(); foreach($products as $key => $value) { $productids[] = $value->id; $productcategoryids[] = $value->product_category; } $quote_lead = DB::table('quote_lead')->orderBy('id','desc')->get(); $leads = array(); foreach($quote_lead as $key => $value) { if($value->type=="popup") { if(in_array($value->product_id, $productids)) { $leads[] = array('lead_id' => $value->id,'status' => $value->status,'action' => $value->action,'product_id' => $value->product_id,'updated_at' => $value->updated_at,'created_at' => $value->created_at, 'product_category_id' => $value->product_category_id,'customer_name' => $value->customer_name,'customer_phone' => $value->customer_phone,'city' => $value->city_id,'type' => $value->type); } }else { if(in_array($value->product_category_id, $productcategoryids)) { $leads[] = array('lead_id' => $value->id,'status' => $value->status,'action' => $value->action,'product_id' => $value->product_id,'updated_at' => $value->updated_at,'created_at' => $value->created_at, 'product_category_id' => $value->product_category_id,'customer_name' => $value->customer_name,'customer_phone' => $value->customer_phone,'city' => $value->city_id,'type' => $value->type); } } } return $leads; } public static function get_vendor_name_by_userid($user_id) { $vendor_id = Helper::get_vendor_id_by_user_id($user_id); $check = DB::table('vendors')->where('id', $vendor_id)->get(); $business_name = ""; foreach($check as $key => $value) { $business_name = $value->business_name; } return $business_name; } public static function get_headquarter_city_by_vendor_id($user_id) { $check = DB::table('vendor_branches')->where('user_id', $user_id)->get(); $city_name = ""; foreach($check as $key => $value) { $city_name = Helper::get_city_name_by_api($value->city_id); } return $city_name; } public static function check_if_default() { $sql = DB::table('lead_stages')->where('is_default', "yes")->get(); return count($sql); } public static function check_status($status_id) { $sql = DB::table('quote_lead')->where('status', $status_id)->get(); $status = 0; foreach($sql as $key => $value) { $status = $value->status; } $checkdisabled = DB::table('lead_stages')->where('id',$status)->get(); $is_disabled = "no"; foreach($checkdisabled as $key => $value) { $is_disabled = $value->is_disabled; } return $is_disabled; } public static function get_filter_attributes_by_product_id($product_id) { $sql = DB::table('product_specification')->where('product_id',$product_id)->limit(4)->get(); return $sql; } public static function get_product_filter_by_attribute($attribute_id) { $sql = DB::table('add_filters')->where('id',$attribute_id)->get(); $filter_id = 0; foreach($sql as $key => $value) { $filter_id = $value->filter_id; } return $filter_id; } public static function get_product_name($product_id) { $sql = DB::table('products')->where('id',$product_id)->get(); $product_name = 0; foreach($sql as $key => $value) { $product_name = $value->product_name; } return $product_name; } public static function calculate_rating_percent($ratingcount,$vendor_user_id) { $sql = DB::table('review_stars')->where('rating', $ratingcount)->where('vendor_user_id', $vendor_user_id)->get(); $rating = 0; foreach($sql as $key => $value) { $rating+= $value->rating; } $parameter_count = DB::table('review_parameters')->count(); $whole = $parameter_count * $ratingcount; if($rating==0) { $rating = 0; }else { $rating = $rating/$whole * 100; $rating = number_format((float)$rating, 0, '.', ''); } return $rating; } public static function get_product_filter($product_category_id) { $sql = DB::table('product_categories_filter')->where('product_category_id',$product_category_id)->get(); return $sql; } public static function check_last_status($lead_id,$vendor_id) { $sql = DB::table('lead_comments')->where('lead_id',$lead_id)->where('identifier','status')->where('vendor_id',$vendor_id)->get(); $status_id = ""; foreach($sql as $key => $value) { $status_id = $value->status_id; } return $status_id; } public static function check_last_action($lead_id,$vendor_id) { $sql = DB::table('lead_comments')->where('lead_id',$lead_id)->where('vendor_id',$vendor_id)->where('identifier','action')->get(); $status_id = ""; foreach($sql as $key => $value) { $status_id = $value->status_id; } return $status_id; } public static function get_vendor_business_type($email) { $user_id = Helper::get_user_id($email); $corporate_essentials = DB::table('corporate_essentials')->where('user_id',$user_id)->get(); $business_type = 0; foreach($corporate_essentials as $key => $value) { $business_type = $value->business_type; } return $business_type; } public static function get_user_name_by_id($user_id) { $sql = DB::table('users')->where('id', $user_id)->get(); $name = ""; foreach($sql as $key => $value) { $name = $value->name; } return $name; } public static function get_phone_by_user_id($user_id) { $sql = DB::table('users')->where('id', $user_id)->get(); $name = ""; foreach($sql as $key => $value) { $name = $value->mobile; } return $name; } public static function get_business_type_name($business_type) { $business_type = DB::table('business_type')->where('id',$business_type)->get(); $label = ""; foreach($business_type as $key => $value) { $label = $value->label; } return $label; } public static function get_product_category($product_id) { $sql = DB::table('products')->where('id',$product_id)->get(); $product_category = ""; foreach($sql as $key => $value) { $product_category = $value->product_category; } return $product_category; } public static function get_product_category_sub($product_id) { $sql = DB::table('product_categories')->where('id',$product_id)->get(); $subcategory_id = "0"; foreach($sql as $key => $value) { $subcategory_id = $value->subcategory_id; } return $subcategory_id; } public static function get_sub_category_name($sub_category_id) { $sql = DB::table('sub_categories')->where('id',$sub_category_id)->get(); $title = ""; foreach($sql as $key => $value) { $title = $value->title; } return $title; } public static function get_areas($city_id) { $url = Helper::location_url()."public/api/get_all_areas/".$city_id; $ch = curl_init(); $accesstoken = "fc9f4a47-4f7f-41ba-a656-d30e0009d6f0"; $headers = array( "Accept: application/json", "Authorization: ".$accesstoken, ); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_URL, $url); $state_name = json_decode(curl_exec($ch)); curl_close($ch); return $state_name; } public static function get_area_name($area) { if($area!="") { $url = "http://app.spherionsolutions.com/public/api/get_area_name/".$area; $ch = curl_init(); $accesstoken = "fc9f4a47-4f7f-41ba-a656-d30e0009d6f0"; $headers = array( "Accept: application/json", "Authorization: ".$accesstoken, ); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_URL, $url); $area_name = curl_exec($ch); curl_close($ch); return $area_name; }else { $area_name = ""; return $area_name; } } public static function get_all_states() { $url = Helper::location_url()."public/api/get_all_states/1"; $ch = curl_init(); $accesstoken = "fc9f4a47-4f7f-41ba-a656-d30e0009d6f0"; $headers = array( "Accept: application/json", "Authorization: ".$accesstoken, ); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_URL, $url); $state_name = json_decode(curl_exec($ch)); curl_close($ch); return $state_name; } public static function clean_string($string) { // $string = str_replace(' ', '-', $string); // Replaces all spaces with hyphens. return preg_replace('/[^A-Za-z0-9\-]/', '', $string); // Removes special chars. } public static function get_super_category_name($super_category_id) { $sql = DB::table('super_categories')->where('id',$super_category_id)->get(); $title = ""; foreach($sql as $key => $value) { $title = $value->title; } return $title; } public static function get_all_super_categories() { $sql = DB::table('product_categories')->orderBy('title','asc')->get(); return $sql; } public static function get_home_super_categories() { $sql = DB::table('super_categories')->where('homepage_presence','yes')->orderBy('sort','asc')->get(); return $sql; } public static function get_all_business_type() { $sql = DB::table('business_type')->get(); return $sql; } public static function get_product_category_name($category_id) { $sql = DB::table('product_categories')->where('id',$category_id)->get(); $title = ""; foreach($sql as $key => $value) { $title = $value->title; } return $title; } public static function get_product_category_by_vendor($email) { $user_id = Helper::get_user_id($email); $sql = DB::table('products')->where('user_id',$user_id)->get(); $productcatarray = array(); foreach($sql as $key => $value) { $productcatarray[] = Helper::get_product_category_name($value->product_category); } return array_unique($productcatarray); } public static function get_state_name_by_api($state_id) { $url = Helper::location_url()."public/api/get_state_name/".$state_id; $ch = curl_init(); $accesstoken = "fc9f4a47-4f7f-41ba-a656-d30e0009d6f0"; $headers = array( "Accept: application/json", "Authorization: ".$accesstoken, ); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_URL, $url); $state_name = curl_exec($ch); curl_close($ch); return $state_name; } public static function get_vendor_logo($email) { $user_id = Helper::get_user_id($email); $corporate = DB::table('corporate_essentials')->where('user_id', $user_id)->get(); $logo = ""; foreach($corporate as $key => $value) { $logo = $value->logo; } return $logo; } public static function get_packaging($packaging_id) { $sql = DB::table('packaging')->where('id', $packaging_id)->get(); $package = ""; foreach($sql as $key => $value) { $package = $value->package; } return $package; } public static function get_product_specification($product_id) { $sql = DB::table('product_specification')->where('product_id', $product_id)->limit(5)->get(); $specification = ""; foreach($sql as $key => $value) { $specification.= "<li><span>".$value->title.":</span> ".$value->value."</li>"; } return $specification; } public static function get_product_specification_product_page($product_id) { $sql = DB::table('product_specification')->where('product_id', $product_id)->get(); return $sql; } public static function get_product_seller($user_id) { $vendor_id = Helper::get_vendor_id_by_user_id($user_id); $sql = DB::table('vendors')->where('id', $vendor_id)->get(); return $sql; } public static function get_vendor_description($email) { $user_id = Helper::get_user_id($email); $corporate = DB::table('corporate_essentials')->where('user_id', $user_id)->get(); $description = ""; foreach($corporate as $key => $value) { $description = $value->description; } return $description; } public static function get_product_image($product_id) { $products = DB::table('product_gallery')->where('product_id', $product_id)->get(); $image = ""; foreach($products as $key => $value) { $image = $value->image; } return $image; } public static function get_product_gallery($product_id) { $products = DB::table('product_gallery')->where('product_id', $product_id)->get(); return $products; } public static function get_similar_product($user_id) { $products = DB::table('products')->where('user_id','!=', $user_id)->get(); return $products; } public static function get_product_notes($product_id) { $products = DB::table('product_others')->where('product_id', $product_id)->get(); return $products; } public static function get_sub_categories($super_category_id) { $sub_categories = DB::table('sub_categories')->where('supercategory_id', $super_category_id)->get(); return $sub_categories; } public static function check_seller_type($type) { $check_type = DB::table('business_type')->where('label',$type)->get(); $business_type_id = 0; foreach($check_type as $key => $value) { $business_type_id = $value->id; } $check = DB::table('corporate_essentials') ->where('business_type', 'LIKE', "%{$business_type_id}%") ->get(); $vendorids = array(); foreach($check as $key => $value) { $vendorids[] = $value->user_id; } return $vendorids; } public static function check_seller_location($city_id,$area) { if($area=="" || $area=="0") { $check = DB::table('vendor_branches') ->where('city_id', $city_id) ->get(); }else { $check = DB::table('vendor_branches') ->where('area_id', $area) ->where('city_id', $city_id) ->get(); } $vendorids = array(); foreach($check as $key => $value) { $vendorids[] = $value->user_id; } return $vendorids; } public static function check_seller_location2($city_id) { $check = DB::table('vendor_branches') ->where('city_id', $city_id) ->distinct() ->get(); $vendorids = array(); foreach($check as $key => $value) { $vendorids[] = $value->user_id; } return $vendorids; } public static function get_device_platform() { $platform = ""; //Detect special conditions devices $iPod = stripos($_SERVER['HTTP_USER_AGENT'],"iPod"); $iPhone = stripos($_SERVER['HTTP_USER_AGENT'],"iPhone"); $iPad = stripos($_SERVER['HTTP_USER_AGENT'],"iPad"); $Android = stripos($_SERVER['HTTP_USER_AGENT'],"Android"); $webOS = stripos($_SERVER['HTTP_USER_AGENT'],"webOS"); //do something with this information if( $iPod || $iPhone ){ $platform = "ios"; }else if($iPad){ $platform = "ios"; }else if($Android){ $platform = "android"; }else if($webOS){ $platform = "web"; } return $platform; } public static function check_app() { $check = false; $isWebView = false; if((strpos($_SERVER['HTTP_USER_AGENT'], 'Mobile/') !== false)) : $isWebView = true; elseif(isset($_SERVER['HTTP_X_REQUESTED_WITH'])) : $isWebView = true; endif; if(!$isWebView) : $check = true; endif; return $check; } public static function check_area_location($area) { $check = DB::table('vendor_branches') ->where('area_id', $area) ->get(); $vendorids = array(); foreach($check as $key => $value) { $vendorids[] = $value->user_id; } return $vendorids; } public static function get_product_categories($sub_category_id) { $sub_categories = DB::table('product_categories')->where('subcategory_id', $sub_category_id)->limit(5)->get(); return $sub_categories; } public static function get_product_categories_by_sub($sub_category_id) { $sub_categories = DB::table('product_categories')->where('subcategory_id', $sub_category_id)->get(); return $sub_categories; } public static function get_all_product_categories() { $sub_categories = DB::table('product_categories')->orderBy('title','ASC')->get(); return $sub_categories; } public static function check_product_count_from_product_categories($product_category_id,$city) { if($city!="0") { $products = DB::table('products')->where('product_category',$product_category_id)->whereRaw('Find_IN_SET(?, specific_city)', [$city])->get(); }else { $products = DB::table('products')->where('product_category',$product_category_id)->get(); } return $products; } public static function check_product_count_from_cities($city) { $products = DB::table('products')->whereRaw('Find_IN_SET(?, specific_city)', [$city])->get(); return $products; } public static function check_product_count_from_state($state_id) { $products = DB::table('vendors')->where('state_id', $state_id)->get(); return $products; } public static function check_product_count_from_product_categories2($product_category_id) { $products = DB::table('products')->where('product_category',$product_category_id)->get(); return $products; } public static function get_product_count_from_subcategories($sub_category_id) { $products = DB::table('products')->where('sub_category_id',$sub_category_id)->get(); return count($products); } public static function get_product_count_from_supercategories($super_category_id) { $products = DB::table('products')->where('super_category_id',$super_category_id)->get(); return count($products); } public static function get_product_count_from_area($area_id) { $products = DB::table('products')->where('area',$area_id)->get(); return count($products); } public static function get_product_count_sub_category($sub_category_id) { $sub_categories = DB::table('products')->where('sub_category_id', $sub_category_id)->count(); return $sub_categories; } public static function get_vendor_products($email) { $user_id = Helper::get_user_id($email); $products = DB::table('products')->where('user_id', $user_id)->limit(4)->get(); $productarray = array(); foreach($products as $key => $value) { $productarray[] = array('product_id' => $value->id, 'product_image' => Helper::get_product_image($value->id) ,'product_name' => $value->product_name,'product_category' => $value->product_category); } return $productarray; } public static function get_products_by_vendor_location($user) { $user_id = Helper::get_user_id($email); $products = DB::table('products')->where('user_id', $user_id)->get(); $productarray = array(); foreach($products as $key => $value) { $productarray[] = array('product_id' => $value->id,'product_category' => $value->product_category,'super_category_id' => $value->super_category_id,'sub_category_id' => $value->sub_category_id ,'product_image' => Helper::get_product_image($value->id) ,'product_name' => $value->product_name, 'min_range' => $value->min_range,'max_range' => $value->max_range,'moq' => $value->moq,'packaging' => $value->packaging); } return $productarray; } public static function get_vendor_products_limit($email) { $user_id = Helper::get_user_id($email); $products = DB::table('products')->where('user_id', $user_id)->get(); $productarray = array(); foreach($products as $key => $value) { $productarray[] = array('product_id' => $value->id,'product_category' => $value->product_category,'super_category_id' => $value->super_category_id,'sub_category_id' => $value->sub_category_id ,'product_image' => Helper::get_product_image($value->id) ,'product_name' => $value->product_name, 'min_range' => $value->min_range,'max_range' => $value->max_range,'moq' => $value->moq,'packaging' => $value->packaging); } return $productarray; } public static function get_vendor_products_by_user_id($user_id,$product_id) { $products = DB::table('products')->where('id','!=', $product_id)->where('user_id', $user_id)->get(); return $products; } public static function get_vendor_products_by_product_user_id($user_id,$product_id, $product_category_id) { $products = DB::table('products') ->where('id','!=', $product_id) ->where('user_id', $user_id) ->where('product_category', $product_category_id) ->limit(3) ->inRandomOrder() ->get(); return $products; } public static function get_corporate_gallery($user_id) { $products = DB::table('corporate_gallery')->where('user_id', $user_id)->get(); return $products; } public static function product_pricing($product_id) { $products = DB::table('product_pricing')->where('product_id', $product_id)->get(); return $products; } public static function get_other_vendor_products_by_user_id($user_id,$product_category_id) { $products = DB::table('products')->where('product_category', $product_category_id)->where('user_id','!=', $user_id)->get(); return $products; } public static function get_other_vendor_products($user_id) { $products = DB::table('products')->where('user_id','!=', $user_id)->limit(2)->inRandomOrder()->get(); return $products; } public static function get_user_id($email) { $sql = DB::table('users')->where('email', $email)->get(); $user_id = 0; foreach($sql as $key => $value) { $user_id = $value->id; } return $user_id; } public static function get_vendor_social_channels($user_id) { $sql = DB::table('social_channels')->where('user_id', $user_id)->get(); return $sql; } public static function get_user_mobile_by_userid($user_id) { $sql = DB::table('users')->where('id', $user_id)->get(); $mobile = ""; foreach($sql as $key => $value) { $mobile = $value->mobile; } return $mobile; } public static function get_user_email_by_userid($user_id) { $sql = DB::table('users')->where('id', $user_id)->get(); $email = ""; foreach($sql as $key => $value) { $email = $value->email; } return $email; } public static function get_vendor_id_by_email($phone) { $sql = DB::table('vendors')->where('mobile', $phone)->get(); $vendor_id = 0; foreach($sql as $key => $value) { $vendor_id = $value->id; } return $vendor_id; } public static function get_user_id_by_phone($phone) { $sql = DB::table('users')->where('mobile', $phone)->get(); $vendor_id = 0; foreach($sql as $key => $value) { $vendor_id = $value->id; } return $vendor_id; } public static function get_vendor_id_by_user_id($user_id) { $sql = DB::table('users')->where('id', $user_id)->get(); $vendorid = 0; foreach($sql as $key => $value) { $vendorid = Helper::get_vendor_id_by_email($value->mobile); } return $vendorid; } public static function get_city_name_by_api($city_id) { $url = Helper::location_url()."public/api/get_city_name/".$city_id; $ch = curl_init(); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_URL, $url); $city_name = curl_exec($ch); curl_close($ch); return $city_name; } public static function get_package_name($package_id) { $sql = DB::table('packages')->where('id',$package_id)->get(); $package_name = ""; foreach($sql as $key => $value) { $package_name = $value->package_name; } return $package_name; } public static function get_duration_name($duration_id) { $sql = DB::table('duration')->where('id',$duration_id)->get(); $duration = ""; foreach($sql as $key => $value) { $duration = $value->duration; } return $duration; } public static function get_city_name($city_id) { $url = Helper::location_url()."public/api/get_city_name/".$city_id; $ch = curl_init(); $accesstoken = "fc9f4a47-4f7f-41ba-a656-d30e0009d6f0"; $headers = array( "Accept: application/json", "Authorization: ".$accesstoken, ); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_URL, $url); $city_name = curl_exec($ch); curl_close($ch); return $city_name; } public static function get_status($status_id) { $sql = DB::table('status_option')->where('id',$status_id)->get(); $status = ""; foreach($sql as $key => $value) { $status = $value->status; } return $status; } public static function get_first_super_category() { $sql = DB::table('super_categories')->get(); $firstcategory = 0; foreach($sql as $key => $value) { if($key==0) { $firstcategory = $value->id; } } return $firstcategory; } public static function get_vendor_essentials($email) { $user_id = Helper::get_user_id($email); $corporate_essentials = DB::table('corporate_essentials')->where('user_id',$user_id)->get(); return $corporate_essentials; } public static function get_formation($foundation_id) { $formation = DB::table('formation')->where('id',$foundation_id)->get(); foreach($formation as $key => $value) { $formation = $value->label; } return $formation; } public static function get_vendor_branch_address($phone) { $user_id = Helper::get_user_id_by_phone($phone); $vendor_branches = DB::table('vendor_branches')->where('user_id',$user_id)->get(); $address = ""; foreach($vendor_branches as $key =>$value) { $address = $value->area.", <div style='margin-left: 38px;'>".Helper::get_city_name($value->city_id).", ".Helper::get_state_name_by_api($value->state_id)."</div>"; } return $address; } public static function get_vendor_renew_history($vendor_id) { $vendor_history = DB::table('renewal_history')->where('vendor_id',$vendor_id)->get(); return $vendor_history; } public static function get_vendor_seller_page($location, $city_id, $super_category_id) { $latitude = Cookie::get('latitude'); $longitude = Cookie::get('longitude'); $distance = "10000"; $vendor_branches = DB::table('vendor_branches')->select('vendor_branches.*')->selectRaw("( 6371000 * acos( cos( radians(?) ) * cos( radians( vendor_branches.latitude ) ) * cos( radians( vendor_branches.longitude ) - radians(?) ) + sin( radians(?) ) * sin( radians( vendor_branches.latitude ) ) ) ) AS distance", [$latitude, $longitude, $latitude])->having("distance","<" ,$distance)->get(); $vendorids = array(); foreach($vendor_branches as $key => $value) { if($super_category_id==0) { $vendorids[] = Helper::get_vendor_id_by_user_id($value->user_id); }else { $products = DB::table('products')->where('product_category',$super_category_id)->where('user_id',$value->user_id)->get(); if(count($products)!=0) { $vendorids[] = Helper::get_vendor_id_by_user_id($value->user_id); } } } if($location!="top-sellers-near-by" && $city_id=="0") { if($super_category_id=="0") { $sql = DB::table('vendors')->where('status', 1)->paginate(9); }else { $vendor_branches = DB::table('vendor_branches')->select('vendor_branches.*')->get(); foreach($vendor_branches as $key => $value) { if($super_category_id==0) { $selectedid[] = Helper::get_vendor_id_by_user_id($value->user_id); }else { $products = DB::table('products')->where('product_category',$super_category_id)->where('user_id',$value->user_id)->get(); if(count($products)!=0) { $selectedid[] = Helper::get_vendor_id_by_user_id($value->user_id); } } } $sql = DB::table('vendors')->where('status', 1)->whereIn('id',$selectedid)->paginate(9); } }else if($location=="top-sellers-near-by") { $sql = DB::table('vendors')->where('status', 1)->whereIn('id',$vendorids)->paginate(9); }else { $selectedid = array(); $vendor_branches = DB::table('vendor_branches')->select('vendor_branches.*')->where('city_id', $city_id)->get(); foreach($vendor_branches as $key => $value) { if($super_category_id==0) { $selectedid[] = Helper::get_vendor_id_by_user_id($value->user_id); }else { $products = DB::table('products')->where('product_category',$super_category_id)->where('user_id',$value->user_id)->get(); if(count($products)!=0) { $selectedid[] = Helper::get_vendor_id_by_user_id($value->user_id); } } } $sql = DB::table('vendors')->where('status', 1)->whereIn('id',$selectedid)->paginate(9); } return $sql; } public static function check_vendor_is_featured($vendor_id) { $check = DB::table('vendor_featured')->where('vendor_id',$vendor_id)->get(); return $check; } public static function get_product_categories_by_product_id($user_id) { $products = DB::table('products')->where('user_id',$user_id)->get(); $product_category = array(); foreach($products as $key => $value) { $product_category[] = $value->product_category; } return array_unique($product_category); } public static function get_vendor_name_by_product_id($product_id) { $products = DB::table('products')->where('id',$product_id)->get(); $vendor_id = ""; foreach($products as $key => $value) { $vendor_id = Helper::get_vendor_id_by_user_id($value->user_id); } return Helper::get_vendor_name($vendor_id); } public static function get_vendor_phone_by_product_id($product_id) { $products = DB::table('products')->where('id',$product_id)->get(); $vendor_id = ""; foreach($products as $key => $value) { $vendor_id = Helper::get_vendor_id_by_user_id($value->user_id); } return Helper::get_vendor_phone_number($vendor_id); } public static function get_overall_rating($vendor_user_id) { $rating = DB::table('review_stars')->where('vendor_user_id',$vendor_user_id)->get(); if(count($rating)!=0) { $finalrating = 0; foreach($rating as $key => $value) { $finalrating+= $value->rating; } if($finalrating==0) { $finalrating = 0; }else { $finalrating = $finalrating/count($rating); $finalrating = number_format((float)$finalrating, 1, '.', ''); } }else { $finalrating = 0; } return $finalrating; } public static function get_overall_rating_user_wise($vendor_user_id,$review_id) { $rating = DB::table('review_stars')->where('vendor_user_id',$vendor_user_id)->where('review_id',$review_id)->get(); if(count($rating)!=0) { $finalrating = 0; foreach($rating as $key => $value) { $finalrating+= $value->rating; } if($finalrating==0) { $finalrating = 0; }else { $finalrating = $finalrating/count($rating); $finalrating = number_format((float)$finalrating, 1, '.', ''); } }else { $finalrating = 0; } return $finalrating; } public static function get_all_parameters() { $db = DB::table('review_parameters')->get(); return $db; } public static function get_all_star_rating($review_id) { $db = DB::table('review_stars')->where('review_id', $review_id)->get(); return $db; } public static function get_star_rating_by_number($finalrating) { $finalstars = ''; if($finalrating==0) { $finalstars = '<li><i class="bi bi-star"></i></li> <li><i class="bi bi-star"></i></li> <li><i class="bi bi-star"></i></li> <li><i class="bi bi-star"></i></li> <li><i class="bi bi-star"></i></li>'; }else { for($x=1;$x<=$finalrating;$x++) { // echo '<span class="fa fa-star"></span>'; $finalstars.= '<li><i class="bi bi-star-fill"></i></li>'; } list($whole, $decimal) = explode('.', $finalrating); if ($decimal!=0) { // echo '<span class="fa fa-star-half-o"></span>'; $finalstars.= '<li><i class="bi bi-star-half"></i></li>'; $x++; } while ($x<=5) { // echo '<span class="fa fa-star-o"></span>'; $finalstars.= '<li><i class="bi bi-star"></i></li>'; $x++; } } return $finalstars; } public static function get_star_rating_by_number3($finalrating) { $finalstars = ''; if($finalrating==0) { $finalstars = '<i class="bi bi-star"></i> <i class="bi bi-star"></i> <i class="bi bi-star"></i> <i class="bi bi-star"></i> <i class="bi bi-star"></i>'; }else { for($x=1;$x<=$finalrating;$x++) { // echo '<span class="fa fa-star"></span>'; $finalstars.= '<i class="bi bi-star-fill"></i> '; } list($whole, $decimal) = explode('.', $finalrating); if ($decimal!=0) { // echo '<span class="fa fa-star-half-o"></span>'; $finalstars.= '<i class="bi bi-star-half"></i> '; $x++; } while ($x<=5) { // echo '<span class="fa fa-star-o"></span>'; $finalstars.= '<i class="bi bi-star"></i> '; $x++; } } return $finalstars; } public static function get_star_rating_by_number2($finalrating) { $finalstars = ''; if($finalrating==0) { $finalstars = '<li><i class="bi bi-star"></i></li> <li><i class="bi bi-star"></i></li> <li><i class="bi bi-star"></i></li> <li><i class="bi bi-star"></i></li> <li><i class="bi bi-star"></i></li>'; }else { for($x=1;$x<=$finalrating;$x++) { // echo '<span class="fa fa-star"></span>'; $finalstars.= '<li><i class="bi bi-star-fill"></i></li>'; } while ($x<=5) { // echo '<span class="fa fa-star-o"></span>'; $finalstars.= '<li><i class="bi bi-star"></i></li>'; $x++; } } return $finalstars; } public static function get_review_count($user_id, $vendor_user_id) { $sql = DB::table('reviews')->where('user_id',$user_id)->where('vendor_user_id', $vendor_user_id)->count(); return $sql; } public static function get_review_count2($vendor_user_id) { $sql = DB::table('reviews')->where('vendor_user_id', $vendor_user_id)->count(); return $sql; } public static function get_user_specific_rating2($vendor_user_id) { $rating = DB::table('review_stars')->where('vendor_user_id',$vendor_user_id)->get(); if(count($rating)!=0) { $finalrating = 0; foreach($rating as $key => $value) { $finalrating+= $value->rating; } if($finalrating==0) { $finalrating = 0; }else { $finalrating = $finalrating/count($rating); $finalrating = number_format((float)$finalrating, 1, '.', ''); } }else { $finalrating = 0; } return $finalrating; } public static function get_user_specific_rating($vendor_user_id, $review_id) { $rating = DB::table('review_stars')->where('review_id',$review_id)->where('vendor_user_id',$vendor_user_id)->get(); if(count($rating)!=0) { $finalrating = 0; foreach($rating as $key => $value) { $finalrating+= $value->rating; } if($finalrating==0) { $finalrating = 0; }else { $finalrating = $finalrating/count($rating); $finalrating = number_format((float)$finalrating, 1, '.', ''); } }else { $finalrating = 0; } return $finalrating; } public static function get_vendor_phone_number($vendor_id) { $sql = DB::table('vendors')->where('id', $vendor_id)->get(); $vendor_mobile = ""; foreach($sql as $key => $value) { $vendor_mobile = $value->mobile; } return $vendor_mobile; } public static function get_vendor_name($vendor_id) { $vendors = DB::table('vendors')->where('id',$vendor_id)->get(); $vendor_name = ""; foreach($vendors as $key => $value) { $vendor_name = $value->business_name; } return $vendor_name; } public static function get_leaderboard($city_id) { if($city_id=="0") { $leaderboard = DB::table('leaderboard')->where('all_india','yes')->where('status',1)->limit(1)->inRandomOrder()->get(); }else { $check = DB::table('leaderboard')->where('city_id','LIKE', "%{$city_id}%")->where('status',1)->get(); if(count($check)==0) { $leaderboard = DB::table('leaderboard')->where('all_india','yes')->where('status',1)->limit(1)->inRandomOrder()->get(); }else { $leaderboard = DB::table('leaderboard')->where('city_id','LIKE', "%{$city_id}%")->orWhere('all_india','yes')->where('status',1)->limit(1)->inRandomOrder()->get(); } } return $leaderboard; } public static function get_products_count($phone) { $user_id = Helper::get_user_id_by_phone($phone); $products = DB::table('products')->where('user_id', $user_id)->count(); return $products; } public static function get_contact_count() { $vendor_id = Helper::get_vendor_id_by_user_id(Auth::user()->id); $products = DB::table('contact_vendor')->where('vendor_id', $vendor_id)->count(); return $products; } public static function get_all_products_count() { $products = DB::table('products')->where('user_id', Auth::user()->id)->count(); return $products; } public static function get_vendor($page_id,$category_id) { if($page_id==3) { $featured = DB::table('vendor_featured_pages')->where('page_id',$page_id)->where('category_id',$category_id)->get(); }else { $featured = DB::table('vendor_featured_pages')->where('page_id',$page_id)->get(); } $featured_id = array(); foreach($featured as $key => $value) { $featured_id[] = $value->featured_id; } $get_vendor_id = DB::table('vendor_featured')->whereIn('id', $featured_id)->inRandomOrder()->get(); $vendor_id = 0; foreach($get_vendor_id as $key => $value) { $vendor_id = $value->vendor_id; } $sql = DB::table('vendors')->where('id',$vendor_id)->where('status',1)->inRandomOrder()->get(); return $sql; } public static function get_vendor_sell_page($page_id,$category_id, $city,$location) { if($page_id==3) { if($city==0 && $category_id==0) { $featured = DB::table('vendor_featured_pages')->where('page_id',$page_id)->get(); }else { $featured = DB::table('vendor_featured_pages')->where('page_id',$page_id)->where('category_id',$category_id)->get(); } }else { $featured = DB::table('vendor_featured_pages')->where('page_id',$page_id)->get(); } $featured_id = array(); foreach($featured as $key => $value) { $featured_id[] = $value->featured_id; } if($location=="top-sellers-near-by") { $latitude = Cookie::get('latitude'); $longitude = Cookie::get('longitude'); $distance = "10000"; $vendor_branches = DB::table('vendor_branches') ->select('vendor_branches.*') ->selectRaw("( 6371000 * acos( cos( radians(?) ) * cos( radians( vendor_branches.latitude ) ) * cos( radians( vendor_branches.longitude ) - radians(?) ) + sin( radians(?) ) * sin( radians( vendor_branches.latitude ) ) ) ) AS distance", [$latitude, $longitude, $latitude]) ->having("distance","<" ,$distance) ->get(); $selectedid = array(); foreach($vendor_branches as $key => $value) { $selectedid[] = Helper::get_vendor_id_by_user_id($value->user_id); } }elseif($location=="top-sellers-in-india") { $vendor_branches = DB::table('vendor_branches') ->select('vendor_branches.*') ->get(); $selectedid = array(); foreach($vendor_branches as $key => $value) { if($category_id==0) { $selectedid[] = Helper::get_vendor_id_by_user_id($value->user_id); }else { $products = DB::table('products')->where('product_category',$category_id)->where('user_id',$value->user_id)->get(); if(count($products)!=0) { $selectedid[] = Helper::get_vendor_id_by_user_id($value->user_id); } } } }else { $selectedid = array(); if($city==0 || $city=="0") { $vendor_branches = DB::table('vendor_branches') ->select('vendor_branches.*') ->get(); }else { $vendor_branches = DB::table('vendor_branches') ->select('vendor_branches.*') ->where('city_id', $city) ->get(); } foreach($vendor_branches as $key => $value) { if($category_id==0) { $selectedid[] = Helper::get_vendor_id_by_user_id($value->user_id); }else { $products = DB::table('products')->where('product_category',$category_id)->where('user_id',$value->user_id)->get(); if(count($products)!=0) { $selectedid[] = Helper::get_vendor_id_by_user_id($value->user_id); } } } } $get_vendor_id = DB::table('vendor_featured') ->whereIn('id', $featured_id) ->whereIn('vendor_id', $selectedid) ->inRandomOrder() ->get(); $vendor_id = 0; foreach($get_vendor_id as $key => $value) { $vendor_id = $value->vendor_id; } $sql = DB::table('vendors')->where('id',$vendor_id)->where('status', 1)->get(); return $sql; } public static function check_branch_type($user_id) { $check = DB::table('vendor_branches')->where('user_id', $user_id)->where('branch_type',"2")->count(); return $check; } public static function check_branch_type2($user_id) { $check = DB::table('branch_type')->where('id',2)->get(); return $check; } public static function check_branch_type3($user_id) { $check = DB::table('branch_type')->where('id',1)->get(); return $check; } public static function get_vendor_id_branch_address($phone, $city_id, $location) { $user_id = Helper::get_user_id_by_phone($phone); $latitude = Cookie::get('latitude'); $longitude = Cookie::get('longitude'); $distance = "10000"; if($city_id!="0") { $branch_address = DB::table('vendor_branches') ->where('user_id', $user_id) ->where('city_id', $city_id)->get(); }else if($city_id=="0" && $location=="top-sellers-near-by") { $branch_address = DB::table('vendor_branches') ->select('vendor_branches.*') ->selectRaw("( 6371000 * acos( cos( radians(?) ) * cos( radians( vendor_branches.latitude ) ) * cos( radians( vendor_branches.longitude ) - radians(?) ) + sin( radians(?) ) * sin( radians( vendor_branches.latitude ) ) ) ) AS distance", [$latitude, $longitude, $latitude]) ->having("distance","<" ,$distance) ->where('user_id', $user_id) ->get(); }else { $branch_address = DB::table('vendor_branches') ->select('vendor_branches.*') ->where('branch_type', 2) ->where('user_id', $user_id) ->get(); } $address = ""; foreach($branch_address as $key => $value) { $address = $value->area. ", ".Helper::get_city_name_by_api($value->city_id).", ".Helper::get_state_name_by_api($value->state_id); } if($address=="") { $branch_address = DB::table('vendor_branches')->where('user_id', $user_id) ->where('branch_type',2)->get(); foreach($branch_address as $key => $value) { $address = $value->area. ", ".Helper::get_city_name_by_api($value->city_id).", ".Helper::get_state_name_by_api($value->state_id); } } return $address; } public static function get_business_type($vendor_id) { $sql = DB::table('vendors')->where('id',$vendor_id)->get(); return $sql; } public static function get_branch_type($id) { $sql = DB::table('branch_type')->where('id',$id)->get(); $type = ""; foreach($sql as $key => $value) { $type = $value->type; } return $type; } public static function get_all_branches($user_id) { $sql = DB::table('vendor_branches')->where('user_id',$user_id)->get(); return $sql; } public static function get_vendor_email($vendor_id) { $sql = DB::table('vendors')->where('id',$vendor_id)->get(); $vendor_email = ""; foreach($sql as $key => $value) { $vendor_email = $value->email; } return $vendor_email; } public static function get_all_cities_from_server() { $url = Helper::location_url()."public/api/get_all_cities"; $ch = curl_init(); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_URL, $url); $cities = json_decode(curl_exec($ch)); curl_close($ch); return $cities; } public static function get_all_cities_from_state($state_id) { $url = Helper::location_url()."public/api/get_citites/".$state_id; $ch = curl_init(); $accesstoken = "fc9f4a47-4f7f-41ba-a656-d30e0009d6f0"; $headers = array( "Accept: application/json", "Authorization: ".$accesstoken, ); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_URL, $url); $states = json_decode(curl_exec($ch)); curl_close($ch); return $states; } public static function get_all_cities() { $sql = DB::table('popular_cities')->get(); $cities = array(); foreach($sql as $key => $value) { $cities[] = array('city_id' => $value->city_id, 'city_name' => Helper::get_city_name_by_api($value->city_id), 'state_name' => Helper::get_state_name_by_api($value->state_id)); } return $cities; } public static function get_popular_cities() { $sql = DB::table('popular_cities')->get(); $cities = array(); foreach($sql as $key => $value) { $cities[] = array('city_id' => $value->city_id, 'city_name' => Helper::get_city_name_by_api($value->city_id)); } return json_encode($cities); } public static function get_vendor_details($vendor_id) { $sql = DB::table('vendors')->where('id',$vendor_id)->get(); $vendor_details = ""; foreach($sql as $key => $value) { $vendor_details = "<b>".$value->business_name."</b><br />".$value->area.", ".Helper::get_city_name_by_api($value->city).", ".Helper::get_state_name_by_api($value->state); } return $vendor_details; } public static function get_vendor_city_state($user_id) { $vendor_id = Helper::get_vendor_id_by_user_id($user_id); $sql = DB::table('vendors')->where('id',$vendor_id)->get(); $vendor_details = ""; foreach($sql as $key => $value) { $vendor_details = Helper::get_city_name_by_api($value->city).", ".Helper::get_state_name_by_api($value->state); } return $vendor_details; } public static function get_vendor_details2() { $vendor_id = Helper::get_vendor_id_by_user_id(Auth::user()->id); $sql = DB::table('vendors')->where('id',$vendor_id)->get(); return $sql; } public static function get_locations_count() { $sql = DB::table('vendor_branches')->where('user_id',Auth::user()->id)->count(); return $sql; } public static function location_url() { $sql = "https://app.spherionsolutions.com/"; return $sql; } public static function get_reviews_count() { $sql = DB::table('reviews')->where('vendor_user_id',Auth::user()->id)->count(); return $sql; } public static function get_state_id_by_city($city) { $sql = DB::table('popular_cities')->where('city_id',$city)->get(); $state_id = "0"; foreach($sql as $key => $value) { $state_id = $value->state_id; } return Helper::get_state_name_by_api($state_id); } public static function get_page_views($vendor_id) { $sql = DB::table('seller_log')->where('vendor_id',$vendor_id)->get(); $total = 0; foreach($sql as $key => $value) { $total+= $value->count; } return $total; } public static function send_otp($mobile, $content) { $content = urlencode($content); $Url = "http://allsms.org/api/SmsApi/SendSingleApiNew?UserID=spherion&Password=yuxc9509YU&SenderID=SKMRTT&Phno=".$mobile."&Msg=".$content; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $Url); curl_setopt($ch, CURLOPT_USERAGENT, "MozillaXYZ/1.0"); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_TIMEOUT, 10); $output = curl_exec($ch); $errmsg = curl_error($ch); $cInfo = curl_getinfo($ch); curl_close($ch); return $output; } public static function get_featured_page_name($featured_id) { $sql = DB::table('featured_pages')->where('id',$featured_id)->get(); $vendor_details = ""; foreach($sql as $key => $value) { $vendor_details = $value->page_name; } return $vendor_details; } public static function get_featured_page_id($featured_id) { $sql = DB::table('vendor_featured_pages')->where('featured_id',$featured_id)->get(); return $sql; } public static function get_featured_pages($featured_id) { $sql = DB::table('vendor_featured_pages')->where('featured_id',$featured_id)->get(); $vendor_details = ""; foreach($sql as $key => $value) { if($value->page_id==3) { $vendor_details.= Helper::get_featured_page_name($value->page_id)." (".Helper::get_super_category_name($value->category_id).")<br /> "; }else { $vendor_details.= Helper::get_featured_page_name($value->page_id)."<br /> "; } } return $vendor_details; } } ?>