public function pages($pages = "") { $accessToken = $this->request->get('access_token'); if ($accessToken != "") { Session::flush(); $accessDetails = UserDevices::getUserDetailsByAccessToken($accessToken); if ($accessDetails > 0) { $user_array = Auth::loginUsingId($accessDetails); //echo "<pre>"; print_r($user_array); $userdata = array('id' => $user_array->id, 'username' => substr($user_array->email, 0, strpos($user_array->email, "@")), 'email' => $user_array->email, 'full_name' => $user_array->full_name, 'user_role' => $user_array->role_id, 'phone' => $user_array->phone_number, 'city_id' => $user_array->location_id, 'facebook_id' => @$user_array->fb_token, 'exp' => "10", 'logged_in' => TRUE); Session::put($userdata); } } //return view('site.users.home'); //this code is start in header and footer page. $cities = Location::where(['Type' => 'City', 'visible' => 1])->lists('name', 'id'); $arrResponse['cities'] = $cities; $arrResponse['user'] = Auth::user(); $city_id = Input::get('city'); $city_name = Location::where(['Type' => 'City', 'id' => $city_id])->pluck('name'); if (empty($city_name)) { $city_name = 'mumbai'; } $arrResponse['allow_guest'] = 'Yes'; $arrResponse['current_city'] = strtolower($city_name); $arrResponse['current_city_id'] = $city_id; /* $commonmodel = new CommonModel(); $arrResponse['allCuisines'] = $commonmodel->getAllCuisines(); $arrResponse['allAreas'] = $commonmodel->getAllAreas(); $arrResponse['allPrices'] = $commonmodel->getAllPrices(); $arrResponse['dropdowns_opt'] = 1; //1 for disp*/ //this code is start in header and footer page. $staticPage = DB::select("SELECT `page_title` , `page_contents` , `slug` , `path` , `seo_title` ,\n\t\t\t\t\t\t\t\t `meta_desc` , `meta_keywords` FROM `cmspages` WHERE slug = '{$pages}'"); //print_r($staticPage); $count = count($staticPage); //echo $count; //print_r(count($count)); /*if($count==0) { echo 'city'; //return Redirect::route('experience.lists'); //return Redirect::action('Site\ExperienceController@lists', array('{city}' => 'mumbai')); //return Redirect::route('experience.lists'); return route('experience.lists', 'mumbai'); } else { return view('frontend.pages.aboutus',$arrResponse)->with('staticPage',$staticPage); }*/ return view('frontend.pages.aboutus', $arrResponse)->with('staticPage', $staticPage); }
/** * Returns the details of the experience * matching the passed id. * * @access public * @param integer $experienceID * @since 1.0.0 * @version 1.0.0 */ public function find($experienceID) { if (!is_numeric($experienceID)) { $query = DB::table('products')->where('slug', $experienceID)->select('id')->first(); if ($query) { $experienceID = $query->id; } else { $arrExpDetails['status'] = Config::get('constants.API_SUCCESS'); $arrExpDetails['no_result_msg'] = 'No matching values found.'; $arrExpDetails['data'] = array(); $arrExpDetails['total_count'] = 0; return $arrExpDetails; } } //query to read product type $queryType = DB::table('products')->where('id', $experienceID)->select('name', 'type')->first(); //print_r($queryType); die(); //Checking the bookmark status of the product $data['access_token'] = $_SERVER['HTTP_X_WOW_TOKEN']; $userID = UserDevices::getUserDetailsByAccessToken($data['access_token']); $bookmark = DB::table('user_bookmarks as ub')->where('user_id', '=', $userID)->where('product_id', '=', $experienceID)->select('id', 'type')->first(); //query to read the experience detail $queryExperience = DB::table('products')->leftJoin('product_attributes_text as pat', 'pat.product_id', '=', 'products.id')->leftJoin('product_attributes as pa', 'pa.id', '=', 'pat.product_attribute_id')->leftJoin('product_pricing as pp', 'pp.product_id', '=', 'products.id')->leftJoin('product_attributes_boolean as pab', 'products.id', '=', 'pab.product_id')->leftJoin('product_attributes as patt', function ($join) { $join->on('patt.id', '=', 'pab.product_attribute_id')->where('patt.alias', '=', 'prepayment_allowed'); })->leftJoin('price_types as pt', 'pt.id', '=', 'pp.price_type')->leftJoin('product_vendor_locations as pvl', 'pvl.product_id', '=', 'products.id')->leftJoin('vendor_locations as vl', 'vl.id', '=', 'pvl.vendor_location_id')->leftJoin('product_media_map as pmm', function ($join) { $join->on('pmm.product_id', '=', 'products.id')->where('pmm.media_type', '=', 'main'); })->leftJoin('product_curator_map as pcm', 'pcm.product_id', '=', 'products.id')->leftJoin('curators', 'curators.id', '=', 'pcm.curator_id')->leftJoin('media', 'media.id', '=', 'pmm.media_id')->leftJoin('media_resized_new as cm', 'cm.id', '=', 'curators.media_id')->join('vendors', 'vendors.id', '=', 'vl.vendor_id')->leftJoin('product_attributes_integer as pai', 'pai.product_id', '=', 'products.id')->leftJoin('product_attributes as pa2', 'pa2.id', '=', 'pai.product_attribute_id')->leftJoin('vendor_location_address as vla', 'vla.vendor_location_id', '=', 'vl.id')->join('locations as loc1', 'loc1.id', '=', 'vla.area_id')->join('locations as loc2', 'loc2.id', '=', 'vla.city_id')->join('locations as loc3', 'loc3.id', '=', 'vla.state_id')->join('locations as loc4', 'loc4.id', '=', 'vla.country_id')->join('locations as loc5', 'loc5.id', '=', 'vl.location_id')->where('products.id', $experienceID)->where('pvl.status', 'Active'); //adding additional parameters in case of simple experience if ($queryType && $queryType->type == 'simple') { $queryExperience->leftJoin(DB::raw('product_attributes_text as pat3'), 'pat3.product_id', '=', 'products.id')->leftJoin(DB::raw('product_attributes as pa3'), 'pa3.id', '=', 'pat3.product_attribute_id')->where('pa3.alias', 'menu')->select('products.id', 'products.name', 'products.type', 'pp.price', 'pp.tax', 'pcm.curator_tips as tips', 'pp.taxes', 'pt.type_name as price_type', 'pp.is_variable', 'pp.post_tax_price', DB::raw('MAX(IF(pa.alias = "experience_info", pat.attribute_value, "")) AS experience_info'), DB::raw('MAX(IF(pa.alias = "short_description", pat.attribute_value, "")) AS short_description'), DB::raw('MAX(IF(pa.alias = "terms_and_conditions", pat.attribute_value, "")) AS terms_and_conditions'), DB::raw('MAX(IF(pa.alias = "menu", pat.attribute_value, "")) AS menu'), DB::raw('MAX(IF(pa.alias = "experience_includes", pat.attribute_value, "")) AS experience_includes'), DB::raw('MAX(IF(pa2.alias = "reward_points_per_reservation", pai.attribute_value,"")) as reward_points'), 'media.file as experience_image', 'curators.name as curator_name', 'curators.bio as curator_bio', 'curators.designation', 'cm.file as curator_image', 'pvl.id as product_vendor_location_id', 'vendors.name as vendor_name', 'loc1.name as area', 'loc1.id as area_id', 'loc2.name as city', 'loc3.name as state_name', 'loc4.name as country', 'loc5.name as locality', 'vla.address', 'vla.pin_code', 'vla.latitude', 'vla.longitude', 'pab.attribute_value as prepayment_allowed', 'products.slug'); } else { $queryExperience->leftJoin(DB::raw('product_attributes_text as pat3'), 'pat3.product_id', '=', 'products.id')->leftJoin(DB::raw('product_attributes as pa3'), 'pa3.id', '=', 'pat3.product_attribute_id')->where('pa3.alias', 'menu')->select('products.id', 'products.name', 'products.type', 'pp.price', 'pp.tax', 'pt.type_name as price_type', 'pp.is_variable', 'pp.post_tax_price', 'pat1.attribute_value as experience_info', 'curators.name as curator_name', 'curators.bio as curator_bio', 'curators.designation', 'pat2.attribute_value as short_description', 'media.file as experience_image', 'cm.file as curator_image', 'pat4.attribute_value as terms_and_condition', 'pvl.id as product_vendor_location_id', 'pcm.curator_tips as tips', 'pat5.attribute_value as experience_includes', 'vendors.name as vendor_name', 'reward_points', 'loc1.name as area', 'loc1.id as area_id', 'loc2.name as city', 'loc3.name as state_name', 'loc4.name as country', 'loc5.name as locality', 'vla.address', 'vla.pin_code', 'vla.latitude', 'vla.longitude', 'pab.attribute_value as prepayment_allowed', 'products.slug'); } //running the query to get the results //echo $queryExperience->t`oSql(); $expResult = $queryExperience->first(); //array to store the experience details $arrExpDetails = array(); if ($expResult) { //reading all the reviews for the particular experience $arrReviews = Review::readProductReviews($expResult->id); //reading other locations where same product is found $arrLocation = Self::getProductLocations($expResult->id, $expResult->product_vendor_location_id); //reading all the images of the product $arrImage = Self::getProductImages($experienceID); //reading all the addons associated with the product $arrAddOn = self::readExperienceAddOns($expResult->id); $arrExpDetails['data'] = array('id' => $expResult->id, 'name' => $expResult->name, 'vendor_name' => is_null($expResult->vendor_name) ? "" : $expResult->vendor_name, 'experience_info' => is_null($expResult->experience_info) ? "" : $expResult->experience_info, 'experience_includes' => is_null($expResult->experience_includes) ? "" : $expResult->experience_includes, 'short_description' => is_null($expResult->short_description) ? "" : $expResult->short_description, 'terms_and_condition' => is_null($expResult->terms_and_conditions) ? "" : $expResult->terms_and_conditions, 'image' => $arrImage, 'type' => $expResult->type, 'reward_points' => is_null($expResult->reward_points) ? 0 : $expResult->reward_points, 'price' => is_null($expResult->price) ? 0 : $expResult->price, 'taxes' => is_null($expResult->taxes) ? 0 : $expResult->taxes, 'pre_tax_price' => is_null($expResult->price) ? "" : $expResult->price, 'post_tax_price' => is_null($expResult->post_tax_price) ? "" : $expResult->post_tax_price, 'tax' => is_null($expResult->tax) ? "" : $expResult->tax, 'price_type' => is_null($expResult->price_type) ? "" : $expResult->price_type, 'curator_information' => array('curator_name' => is_null($expResult->curator_name) ? "" : $expResult->curator_name, 'curator_bio' => is_null($expResult->curator_bio) ? "" : $expResult->curator_bio, 'curator_image' => is_null($expResult->curator_image) ? "" : Config::get('constants.API_MOBILE_IMAGE_URL') . $expResult->curator_image, 'curator_designation' => is_null($expResult->designation) ? "" : $expResult->designation, 'suggestions' => is_null($expResult->tips) ? "" : $expResult->tips), 'menu' => is_null($expResult->menu) ? "" : $expResult->menu, 'rating' => is_null($arrReviews['avg_rating']) ? 0 : $arrReviews['avg_rating'], 'total_reviews' => $arrReviews['total_rating'], 'review_detail' => $arrReviews['reviews'], 'location' => $arrLocation, 'similar_option' => array(), 'prepayment_allowed' => empty($expResult->prepayment_allowed) ? '' : $expResult->prepayment_allowed, 'addons' => $arrAddOn, 'location_address' => array("address_line" => is_null($expResult->address) ? "" : $expResult->address, "locality" => is_null($expResult->locality) ? "" : $expResult->locality, "area" => is_null($expResult->area) ? "" : $expResult->area, "city" => is_null($expResult->city) ? "" : $expResult->city, "pincode" => is_null($expResult->pin_code) ? "" : $expResult->pin_code, "state" => is_null($expResult->state_name) ? "" : $expResult->state_name, "country" => is_null($expResult->country) ? "" : $expResult->country, "latitude" => is_null($expResult->latitude) ? "" : $expResult->latitude, "longitude" => is_null($expResult->longitude) ? "" : $expResult->longitude), 'slug' => $expResult->slug, 'bookmark_status' => is_null($bookmark) ? 0 : 1); $arrExpDetails['status'] = Config::get('constants.API_SUCCESS'); } return $arrExpDetails; }
/** * Handle the request to unbookmark. * * @param int $id * @param string $type * @return Response */ public function unbookmark($type, $id) { $data['access_token'] = $_SERVER['HTTP_X_WOW_TOKEN']; $userID = UserDevices::getUserDetailsByAccessToken($data['access_token']); if (!empty($userID) && !empty($type) && !empty($id)) { $userBookmark = new UserBookmarks(); if ($type == 'experience') { $status = $userBookmark->where('user_id', '=', $userID)->where('product_id', '=', $id)->delete(); } if ($type == 'alacarte') { $status = $userBookmark->where('user_id', '=', $userID)->where('vendor_location_id', '=', $id)->delete(); } if ($status) { $arrResponse['status'] = Config::get('constants.API_SUCCESS'); } else { $arrResponse['status'] = Config::get('constants.API_ERROR'); } } else { $arrResponse['status'] = Config::get('constants.API_ERROR'); } return $arrResponse; }
/** * Reads the detail of the experience matching passed criteria. * * @access public * @param $arrData * @since 1.0.0 * @version 1.0.0 */ public function findMatchingExperience($arrData) { $experienceQuery = DB::table('products')->leftJoin('product_attributes_text as pat', 'pat.product_id', '=', 'products.id')->leftJoin('product_attributes_text as pat2', 'pat2.product_id', '=', 'products.id')->leftJoin('product_media_map as pmm', 'pmm.product_id', '=', 'products.id')->leftJoin('media', 'media.id', '=', 'pmm.media_id')->leftJoin('product_pricing as pp', 'pp.product_id', '=', 'products.id')->leftJoin('price_types as pt', 'pt.id', '=', 'pp.price_type')->join('product_vendor_locations as pvl', 'pvl.product_id', '=', 'products.id')->leftJoin('vendor_location_address as vla', 'vla.vendor_location_id', '=', 'pvl.vendor_location_id')->leftJoin('product_flag_map as pfm', 'pfm.product_id', '=', 'products.id')->leftJoin('flags', 'flags.id', '=', 'pfm.flag_id')->leftJoin('vendor_locations as vl', 'vl.id', '=', 'pvl.vendor_location_id')->leftJoin('locations', 'locations.id', '=', 'vla.area_id')->join('locations as loc1', 'loc1.id', '=', 'vla.area_id')->join('locations as loc2', 'loc2.id', '=', 'vla.city_id')->join('locations as loc3', 'loc3.id', '=', 'vla.state_id')->join('locations as loc4', 'loc4.id', '=', 'vla.country_id')->join('locations as loc5', 'loc5.id', '=', 'vl.location_id')->leftJoin('product_attributes as pa1', 'pa1.id', '=', 'pat.product_attribute_id')->leftJoin('product_attributes as pa2', 'pa2.id', '=', 'pat2.product_attribute_id')->where('pvl.status', 'Active')->where('pa1.alias', 'experience_info')->where('pa2.alias', 'short_description')->where('vla.city_id', $arrData['city_id'])->where('products.visible', 1)->where('products.status', '=', 'publish')->whereIN('products.type', array('simple', 'complex'))->whereIN('pvl.show_status', array('show_in_all', 'hide_in_web'))->groupBy('products.id')->orderBy('pvl.order_status', 'asc')->select('products.id', 'products.name as title', 'pat.attribute_value as description', 'pat2.attribute_value as short_description', 'pp.price', 'pt.type_name as price_type', 'pp.is_variable', 'pp.tax', 'pp.post_tax_price', 'media.file as image', 'pp.taxes', 'products.type as product_type', 'flags.name as flag_name', 'locations.id as location_id', 'locations.name as location_name', 'vla.latitude', 'vla.longitude', 'vla.address', 'loc1.name as area', 'loc1.id as area_id', 'loc2.name as city', 'loc3.name as state_name', 'loc4.name as country', 'vla.pin_code', 'loc5.name as locality', 'ub.id as bookmarked'); //echo $experienceQuery->toSql(); //adding filter for cuisines if cuisines are present if (isset($arrData['cuisine'])) { $experienceQuery->join('product_attributes_multiselect as pam', 'pam.product_id', '=', 'products.id')->join('vendor_attributes_select_options as vaso', 'vaso.id', '=', 'pam.product_attributes_select_option_id')->whereIn('vaso.id', $arrData['cuisine']); } if (!empty($_SERVER['HTTP_X_WOW_TOKEN'])) { $access_token = $_SERVER['HTTP_X_WOW_TOKEN']; $userId = UserDevices::getUserDetailsByAccessToken($access_token); } else { $userId = 0; } $experienceQuery->leftJoin('user_bookmarks as ub', function ($join) use($userId) { $join->on('products.id', '=', 'ub.product_id')->where('ub.user_id', '=', $userId); }); //adding filter for locations if locations are present if (isset($arrData['area'])) { $experienceQuery->whereIn('locations.id', $arrData['area']); } //adding filter for tags if tags are present if (isset($arrData['tag'])) { $experienceQuery->leftJoin(DB::raw('product_tag_map as ptm'), 'ptm.product_id', '=', 'products.id')->leftJoin('tags', 'tags.id', '=', 'ptm.tag_id')->whereIn('tags.id', $arrData['tag']); } //adding filter for price if price has been selected if (isset($arrData['minPrice']) && isset($arrData['maxPrice'])) { $experienceQuery->whereBetween('pp.price', array($arrData['minPrice'], $arrData['maxPrice'])); } else { if (isset($arrData['minPrice'])) { $experienceQuery->where('pp.price', '>=', $arrData['minPrice']); } else { if (isset($arrData['maxPrice'])) { $experienceQuery->where('pp.price', '<=', $arrData['maxPrice']); } } } //executing the query $experienceResult = $experienceQuery->get(); //array to store the product ids $arrProduct = array(); //array to store final result $arrData = array(); #query executed successfully if ($experienceResult) { $arrData['resultCount'] = 0; $arrData['experiences'] = array(); #initializing the total number of matching rows returned $arrData['resultCount'] = count($experienceResult); #initializing the array of products foreach ($experienceResult as $row) { $arrProduct[] = $row->id; } #reading the product ratings detail $arrRatings = $this->findRatingByProduct($arrProduct); $arrImage = $this->getExperienceImages($arrProduct); //array to store location IDs $arrLocationId = array(); foreach ($experienceResult as $row) { if (!is_null($row->price)) { $this->minPrice = $this->minPrice > $row->price || $this->minPrice == 0 ? $row->price : $this->minPrice; $this->maxPrice = $this->maxPrice < $row->price || $this->maxPrice == 0 ? $row->price : $this->maxPrice; } $arrData['data'][] = array('id' => $row->id, 'type' => $row->product_type, 'name' => $row->title, 'description' => $row->description, 'bookmarked' => is_null($row->bookmarked) ? 0 : 1, 'short_description' => $row->short_description, 'price' => $row->price, 'taxes' => $row->taxes, 'pre_tax_price' => is_null($row->price) ? "" : $row->price, 'post_tax_price' => is_null($row->post_tax_price) ? "" : $row->post_tax_price, 'tax' => is_null($row->tax) ? "" : $row->tax, 'price_type' => is_null($row->price_type) ? "" : $row->price_type, 'variable' => is_null($row->is_variable) ? "" : $row->is_variable, 'image' => array_key_exists($row->id, $arrImage) ? $arrImage[$row->id] : "", 'coordinates' => array('latitude' => is_null($row->latitude) ? "" : $row->latitude, 'longitude' => is_null($row->longitude) ? "" : $row->longitude), 'rating' => array_key_exists($row->id, $arrRatings) ? $arrRatings[$row->id]['averageRating'] : 0, 'total_reviews' => array_key_exists($row->id, $arrRatings) ? $arrRatings[$row->id]['totalRating'] : 0, "flag" => is_null($row->flag_name) ? "" : $row->flag_name, 'location_address' => array(["address_line" => $row->address, "locality" => $row->locality, "area" => $row->area, "city" => $row->city, "pincode" => $row->pin_code, "state" => $row->state_name, "country" => $row->country, "latitude" => $row->latitude, "longitude" => $row->longitude])); #setting up the value for the location filter if (!in_array($row->location_id, $arrLocationId)) { $arrLocationId[] = $row->location_id; $this->filters['locations'][] = array("id" => $row->location_id, "name" => $row->location_name, "count" => 1); } else { foreach ($this->filters['locations'] as $key => $value) { if ($value['id'] == $row->location_id) { $this->filters['locations'][$key]['count']++; } } } } #setting up remaining filters $this->initializeExperienceFilters($arrProduct); } return $arrData; }
/** * Reads all the experiences avalilable at a particular * restaurant. * * @access public * @static true * @param integer $vendorID * @return array * @since 1.0.0 */ public static function readRestaurantsExperiences($vendorID) { //query to read experiences available at the Restaurant $queryResult = DB::table('products as p')->join('product_vendor_locations as pvl', 'pvl.product_id', '=', 'p.id')->join('vendor_locations as vl', 'vl.id', '=', 'pvl.vendor_location_id')->leftJoin('product_attributes_text as pat', 'pat.product_id', '=', 'p.id')->leftJoin('product_attributes as pa', 'pa.id', '=', 'pat.product_attribute_id')->leftJoin('product_pricing as pp', 'pp.product_id', '=', 'p.id')->leftJoin('product_reviews AS pr', function ($join) { $join->on('p.id', '=', 'pr.product_id')->on('pr.status', '=', DB::raw('"Approved"')); })->leftJoin('locations as loc', 'loc.id', '=', 'vl.location_id')->leftJoin('product_flag_map as pfm', 'pfm.product_id', '=', 'p.id')->leftJoin('flags', 'flags.id', '=', 'pfm.flag_id')->leftJoin('product_media_map as pmm', 'pmm.product_id', '=', 'p.id')->leftJoin('media_resized_new as mrn1', 'mrn1.media_id', '=', 'pmm.media_id')->leftJoin('media_resized_new as mrn2', 'mrn2.media_id', '=', 'pmm.media_id')->leftjoin('price_types as pt', 'pt.id', '=', 'pp.price_type')->where('vl.vendor_id', $vendorID)->where('p.status', 'Publish')->where('pvl.status', 'Active')->where('mrn1.image_type', 'mobile_listing_ios_experience')->where('mrn2.image_type', 'mobile_listing_android_experience')->select('p.id as product_id', 'p.name', 'pvl.id as pvl_id', 'ub.id as bookmarked', DB::raw('COUNT(DISTINCT pr.id) AS total_reviews'), DB::raw('MAX(IF(pa.alias = "short_description", pat.attribute_value, "")) AS short_description'), DB::raw('If(count(DISTINCT pr.id) = 0, 0, ROUND(AVG(pr.rating), 2)) AS rating'), DB::raw('GROUP_CONCAT(DISTINCT loc.name separator ", ") as location_name'), 'mrn1.file as ios_image', 'mrn2.file as android_image', 'flags.name as flag_name', 'pp.post_tax_price', 'pp.price', 'pp.taxes', 'pt.type_name as price_type')->groupBy('p.id'); // ->get(); //checking if city has been passed in if (array_key_exists('HTTP_X_WOW_CITY', $_SERVER)) { $queryResult = $queryResult->join('vendor_location_address as vla', 'vla.vendor_location_id', '=', 'vl.id')->where('vla.city_id', '=', $_SERVER["HTTP_X_WOW_CITY"]); } if (!empty($_SERVER['HTTP_X_WOW_TOKEN'])) { $access_token = $_SERVER['HTTP_X_WOW_TOKEN']; $userId = UserDevices::getUserDetailsByAccessToken($access_token); } else { $userId = 0; } $queryResult = $queryResult->leftJoin('user_bookmarks as ub', function ($join) use($userId) { $join->on('p.id', '=', 'ub.product_id')->where('ub.user_id', '=', $userId); }); //executing the query $queryResult = $queryResult->get(); //array to store the information from the DB $data = array(); if ($queryResult) { foreach ($queryResult as $row) { $data[] = array('prod_id' => $row->product_id, 'pvl_id' => $row->pvl_id, 'name' => $row->name, 'bookmarked' => is_null($row->bookmarked) ? 0 : 1, 'total_reviews' => $row->total_reviews, 'rating' => $row->rating, 'price' => $row->price, 'post_tax_price' => $row->post_tax_price, 'taxes' => $row->taxes, 'price_type' => $row->price_type, 'location' => $row->location_name, 'flag' => empty($row->flag_name) ? "" : $row->flag_name, 'short_description' => $row->short_description, 'image' => array('mobile_listing_android_experience' => empty($row->android_image) ? "" : Config::get('constants.API_MOBILE_IMAGE_URL') . $row->android_image, 'mobile_listing_ios_experience' => empty($row->ios_image) ? "" : Config::get('constants.API_MOBILE_IMAGE_URL') . $row->ios_image)); } } return $data; }
/** * Handles requst for displaying the redeemRewards page. * record of the logged in user. * * @access public * @param string $access_token * @return response * @since 1.0.0 */ public function redeemRewards() { $accessToken = $this->request->get('access_token'); if ($accessToken != "") { Session::flush(); $accessDetails = UserDevices::getUserDetailsByAccessToken($accessToken); if ($accessDetails > 0) { $user_array = Auth::loginUsingId($accessDetails); //echo "<pre>"; print_r($user_array); $userdata = array('id' => $user_array->id, 'username' => substr($user_array->email, 0, strpos($user_array->email, "@")), 'email' => $user_array->email, 'full_name' => $user_array->full_name, 'user_role' => $user_array->role_id, 'phone' => $user_array->phone_number, 'city_id' => $user_array->location_id, 'facebook_id' => @$user_array->fb_token, 'exp' => "10", 'logged_in' => TRUE); Session::put($userdata); } } $user_array = Session::all(); //$userID =Session::get('id'); //this code is start in header and footer page. $cities = Location::where(['Type' => 'City', 'visible' => 1])->lists('name', 'id'); $arrResponse['cities'] = $cities; $arrResponse['user'] = Auth::user(); $city_id = Input::get('city'); $city_name = Location::where(['Type' => 'City', 'id' => $city_id])->pluck('name'); if (empty($city_name)) { $city_name = 'mumbai'; } $arrResponse['allow_guest'] = 'Yes'; $arrResponse['current_city'] = strtolower($city_name); $arrResponse['current_city_id'] = $city_id; //this code is start in header and footer page. $id = Session::get('id'); //$data=Profile::getUserProfileWeb($id); return view('frontend.pages.redeemrewards', $arrResponse); }
/** * Handle requests for payment failure response by PayU. * * @access public * @return response * @since 1.0.0 */ public function getFailureResponse() { //reading data input by the user $data = $this->request->all(); //Setting token value if user has not sent the token in request if (!isset($data['access_token'])) { $data['access_token'] = $_SERVER['HTTP_X_WOW_TOKEN']; } $userID = UserDevices::getUserDetailsByAccessToken($data['access_token']); $reservationID = $this->request->input('reservationID'); $arrResponse = ReservationDetails::cancelReservation($reservationID, $this->mailchimp, $userID); return response()->json($data, 200); }
/** * Handles requst for displaying the historical reservation * record of the logged in user. * * @access public * @param string $access_token * @return response * @since 1.0.0 */ public function reservationRecord() { $access_token = $_SERVER['HTTP_X_WOW_TOKEN']; $userID = UserDevices::getUserDetailsByAccessToken($access_token); if ($userID) { $arrResponse = Reservation::getReservationRecord($userID); } else { $arrResponse['status'] = Config::get('constants.API_ERROR'); $arrResponse['msg'] = 'Not a valid request'; } return response()->json($arrResponse, 200); }
public function fetchListings(array $filters, $items_per_page = 10, $sort_by = 'Latest', $pagenum = null) { if (!$pagenum) { $pagenum = 1; } $offset = ($pagenum - 1) * $items_per_page; if (!empty($_SERVER['HTTP_X_WOW_TOKEN'])) { $access_token = $_SERVER['HTTP_X_WOW_TOKEN']; $userId = UserDevices::getUserDetailsByAccessToken($access_token); } else { $userId = 0; } $select = DB::table('vendor_locations AS vl')->join('vendors AS v', 'v.id', '=', 'vl.vendor_id')->join('vendor_types AS vt', 'vt.id', '=', 'v.vendor_type_id')->join('vendor_location_address AS vladd', 'vl.id', '=', 'vladd.vendor_location_id')->join('locations AS l', 'l.id', '=', 'vl.location_id')->join('locations AS la', 'la.id', '=', 'vladd.area_id')->join('locations AS lc', 'lc.id', '=', 'vladd.city_id')->join('vendor_location_attributes_varchar AS vlav', 'vl.id', '=', 'vlav.vendor_location_id')->join('vendor_attributes AS va', 'va.id', '=', 'vlav.vendor_attribute_id')->leftJoin('vendor_location_attributes_multiselect AS vlam', 'vl.id', '=', 'vlam.vendor_location_id')->leftJoin('vendor_attributes AS vamso', function ($join) { $join->on('va.id', '=', 'vlav.vendor_attribute_id')->on('vamso.alias', '=', DB::raw('"cuisines"')); })->leftJoin('vendor_attributes_select_options AS vaso', 'vaso.id', '=', 'vlam.vendor_attributes_select_option_id')->leftJoin('vendor_location_booking_schedules AS vlbs', 'vlbs.vendor_location_id', '=', 'vl.id')->leftJoin('vendor_location_blocked_schedules AS vlbls', 'vlbls.vendor_location_id', '=', 'vl.id')->leftJoin('schedules AS s', 'vlbs.schedule_id', '=', 's.id')->leftJoin('time_slots AS ts', 's.time_slot_id', '=', 'ts.id')->leftJoin('vendor_locations_tags_map AS vltm', 'vl.id', '=', 'vltm.vendor_location_id')->leftJoin('vendor_location_reviews AS vlr', function ($join) { $join->on('vl.id', '=', 'vlr.vendor_location_id')->on('vlr.status', '=', DB::raw('"Approved"')); })->leftJoin(DB::raw('vendor_locations_flags_map as vlfm'), 'vlfm.vendor_location_id', '=', 'vl.id')->leftJoin('flags', 'flags.id', '=', 'vlfm.flag_id')->leftjoin('vendor_location_address as vlaa', 'vlaa.vendor_location_id', '=', 'vl.id')->join('locations as loc1', 'loc1.id', '=', 'vlaa.area_id')->join('locations as loc2', 'loc2.id', '=', 'vlaa.city_id')->join('locations as loc3', 'loc3.id', '=', 'vlaa.state_id')->join('locations as loc4', 'loc4.id', '=', 'vlaa.country_id')->join('locations as loc5', 'loc5.id', '=', 'vl.location_id')->leftJoin('user_bookmarks as ub', function ($join) use($userId) { $join->on('vl.id', '=', 'ub.vendor_location_id')->where('ub.user_id', '=', $userId); })->select(DB::raw('SQL_CALC_FOUND_ROWS vl.id'), 'v.name AS restaurant', 'l.name AS locality', 'la.name AS area', 'la.id as area_id', 'vl.pricing_level', 'vladd.latitude', 'vladd.longitude', 'ub.id as bookmarked', 'vlaa.latitude', 'vlaa.longitude', 'vlaa.address', 'vlaa.pin_code', 'loc1.name as area', 'loc1.id as area_id', 'loc2.name as city', 'loc3.name as state_name', 'loc4.name as country', 'loc5.name as locality', 'l.id as location_id', DB::raw('MAX(IF(va.alias = "short_description", vlav.attribute_value, null)) AS short_description'), DB::raw('MAX(vlbs.off_peak_schedule) AS off_peak_available'), DB::raw('COUNT(DISTINCT vlr.id) AS total_reviews'), DB::raw('If(count(DISTINCT vlr.id) = 0, 0, ROUND(AVG(vlr.rating), 2)) AS rating'), DB::raw('IFNULL(flags.name,"") AS flag_name'), DB::raw('GROUP_CONCAT(DISTINCT vaso.option separator ", ") as cuisine'))->where('vt.type', DB::raw('"Restaurants"'))->where('v.status', DB::raw('"Publish"'))->where('v.publish_time', '<', DB::raw('NOW()'))->where('lc.id', $filters['city_id'])->where('vl.a_la_carte', 1)->where('vl.status', 'Active')->groupBy('vl.id'); // ->skip($offset)->take($items_per_page); if (isset($filters['area'])) { $select->whereIn('la.id', $filters['area']); //$this->filters['areas']['active'] = $filters['area']; } /* if(isset($filters['pricing_level'])){ if(strtolower($filters['pricing_level']) == 'high') { $select->whereIn('vl.pricing_level',array('Low','Medium','High')); } elseif(strtolower($filters['pricing_level']) == "medium") { $select->whereIn('vl.pricing_level',array('Low','Medium')); } elseif(strtolower($filters['pricing_level']) == "low") { $select->whereIn('vl.pricing_level',array('Low')); } //$this->filters['pricing_level']['active'] = $filters['pricing_level']; } */ /* setting up the pricing level filter */ if (isset($filters['pricing_level'])) { $select->whereIn('vl.pricing_level', $filters['pricing_level']); } if (isset($filters['tag'])) { $select->whereIn('vltm.tag_id', $filters['tag']); //$this->filters['tag']['active'] = $filters['tag']; } if (isset($filters['cuisine'])) { $select->whereIn('vaso.id', $filters['cuisine']); //$this->filters['cuisine']['active'] = $filters['cuisine']; } if (isset($filters['date']) && isset($filters['time'])) { $select->where('s.day', '=', DB::raw('DAYNAME("' . $filters['date'] . '")'))->whereNotIn('vlbls.block_date', [$filters['date']])->where('ts.time', $filters['time']); $this->filters['tags']['date'] = $filters['date']; $this->filters['tags']['time'] = $filters['time']; } else { if (isset($filters['date'])) { $select->where('s.day', '=', DB::raw('DAYNAME("' . $filters['date'] . '")'))->whereNotIn('vlbls.block_date', [$filters['date']]); $this->filters['tags']['date'] = $filters['date']; } else { if (isset($filters['time'])) { $select->where('ts.time', $filters['time']); $this->filters['tags']['time'] = $filters['time']; } } } if ($sort_by === 'Popular') { $select->orderBy('vl.id', 'asc'); } else { if ($sort_by === 'Latest') { $select->orderBy('v.publish_time', 'desc'); } else { $select->orderBy('v.publish_time', 'desc'); } } //echo $select->toSql(); $this->listing = $select->get(); $this->formatResultToArray($this->listing); $totalCountResult = DB::select('SELECT FOUND_ROWS() AS total_count'); //dd($totalCountResult); if ($totalCountResult) { $this->total_count = $totalCountResult[0]->total_count; $this->total_pages = (int) ceil($this->total_count / $items_per_page); // $this->fetchFilters($filters); // $this->fetchMaxDate(); // $this->fetchTimings(); } else { $this->total_count = 0; $this->total_pages = 0; } }