Ejemplo n.º 1
0
 /**
  * addReview view details of the user
  *
  * @static  true
  * @access  public
  * @param   post
  * @since   1.0.0
  */
 public function saveReview()
 {
     $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');
     $user_id = Input::get('user_id');
     $rating = Input::get('rating');
     $user_email = Input::get('user_email');
     $member_name = Input::get('member_name');
     $reservid = Input::get('reservid');
     $reservation_type = Input::get('reservation_type');
     $membership_num = Input::get('membership_num');
     $seating_date = Input::get('seating_date');
     $review_para = Input::get('review_para');
     $name_server = Input::get('name_server');
     $service = Input::get('service');
     $suggestion = Input::get('suggestion');
     $exp_name = Input::get('exp_name');
     $city = Input::get('city');
     if ($reservation_type == "experience") {
         $product_id = Input::get('product_id');
         $productReviews = new ProductReviews();
         $productReviews->product_id = $product_id;
         $productReviews->user_id = $user_id;
         $productReviews->reserv_id = $reservid;
         $productReviews->review = $review_para;
         $productReviews->server_name = $name_server;
         $productReviews->service = $service;
         $productReviews->suggestions = $suggestion;
         $productReviews->rating = $rating;
         $productReviews->save();
         /*DB::insert("insert into product_reviews(product_id,user_id,reserv_id,review,server_name,service,suggestions,rating)
           values ('$product_id', '$user_id', '$reservid', '$review_para', '$name_server', '$service', '$suggestion', '$rating')");*/
         //echo 'experience';
     } else {
         if ($reservation_type == "alacarte") {
             $vendor_location_id = Input::get('vendor_location_id');
             $vendorLocationReview = new VendorLocationsReviews();
             $vendorLocationReview->vendor_location_id = $vendor_location_id;
             $vendorLocationReview->user_id = $user_id;
             $vendorLocationReview->reserv_id = $reservid;
             $vendorLocationReview->review = $review_para;
             $vendorLocationReview->server_name = $name_server;
             $vendorLocationReview->service = $service;
             $vendorLocationReview->suggestions = $suggestion;
             $vendorLocationReview->rating = $rating;
             $vendorLocationReview->save();
             /*DB::insert("insert into vendor_location_reviews(vendor_location_id,user_id,reserv_id,review,server_name,service,suggestions,rating)
               values ('$vendor_location_id', '$user_id', '$reservid', '$review_para', '$name_server', '$service', '$suggestion', '$rating')");*/
             //echo 'alacarte';
         }
     }
     $add_points = 500;
     DB::update('UPDATE users SET points_earned = points_earned + ' . $add_points . ' WHERE id = ' . $user_id);
     Mail::send('site.pages.review_mail_user', ['member_name' => $member_name, 'email_id' => $user_email, 'exp_name' => $exp_name, 'rating' => $rating, 'review_para' => $review_para, 'name_server' => $name_server, 'service' => $service, 'suggestion' => $suggestion, 'membership_num' => $membership_num], function ($message) use($exp_name, $member_name) {
         $message->from('*****@*****.**', 'WowTables by GourmetItUp');
         $message->to('*****@*****.**')->subject(' New Feedback on ' . $exp_name . ' by ' . $member_name . '');
         $message->cc(['*****@*****.**', '*****@*****.**']);
     });
     $page_text = "<center><h2>Thank you for your review.</h2></center>";
     $page_text .= "<p>Dear " . ucfirst($member_name) . ",</p>";
     //if review is 1 or 2
     if ($rating == 1 || $rating == 2) {
         $page_text .= "<p>Thank you for your review. Your Gourmet Points have been added to your account.</p>";
         $page_text .= "<p>We are sorry you did not have a satisfactory dining experience. WowTables is dedicated to doing everything possible to make sure you enjoy our services and restaurants.</p>";
         $page_text .= "<p>Our concierge desk will be contacting you by phone or email to understand the issue better so that we can attempt to resolve it, convey the feedback to the restaurant's management and improve the experience for the next time. You can also reach out to our concierge desk at anytime by emailing <a href='mailto:concierge@wowtables.com'>concierge@wowtables.com</a> or by calling 09619551387.</p>";
         $page_text .= "<p>Our member feedback is reviewed by me personally every week. However if you wish to reach out to me directly, my personal email address is <a href='mailto:kunal@wowtables.com'>kunal@wowtables.com</a>.</p>";
         $page_text .= "<p>Thanks again and we assure you a better experience next time!</p>";
         $page_text .= "<p>Regards,<br/>Kunal Jain<br/>Co-founder - WowTables</p>";
     } else {
         if ($rating == 3) {
             //if review is 3
             $page_text .= "<p>Thank you for your review. Your Gourmet Points have been added to your account.</p>";
             if ($reservation_type == "experience") {
                 $page_text .= "<p>All member feedback is reviewed by the WowTables founding team personally and used to continuously improve our experiences and services. </p>";
             }
             $page_text .= "<p>Thanks again and we assure you a better experience next time!</p>";
             $page_text .= "<p>Regards,<br/>The WowTables Team</p>";
         } else {
             if ($rating == 4 || $rating == 5) {
                 //if review is 4 or 5
                 $page_text .= "<p>Thank you for your review. Your Gourmet Points have been added to your account.</p>";
                 $page_text .= "<p>We're glad that you had a good experience with WowTables and look forward to seeing you again!</p>";
                 if ($reservation_type == "experience") {
                     $page_text .= "<p>P.S. Help us grow by posting this review on social media & external review sites. Don't forget to mention that others can access this experience through the Wowtables website! </p>";
                     $page_text .= "<p>Send us a screenshot at <a href='mailto:concierge@wowtables.com'>concierge@wowtables.com</a> and we'll send you a Rs. 500 WowTables gift card for your next experience! </p>";
                 } else {
                     if ($reservation_type == "alacarte") {
                         $page_text .= "<p>P.S. Help us grow by posting this review on social media & external reveiw sites. Do mention our reservations services and send us a screenshot to get a Rs. 500 gift card towards your next experience reservation. Thanks!</p>";
                     }
                 }
                 $page_text .= "<p>Thanks again and we assure you a better experience next time!</p>";
                 $page_text .= "<p>Regards,<br/>The WowTables Team</p>";
             }
         }
     }
     $page_text .= "<p class='text-center lead'>\n                                <a class='btn btn-warning' href='" . URL::to('/') . '/' . $city . "'>Return to experiences</a>\n                           </p>";
     return view('frontend.pages.thankyou_addreview', $arrResponse)->with('page_text', $page_text);
 }
 public function experienceReviewAdd()
 {
     $data = RequestData::all();
     $rules = array('email' => 'required|exists:users,email', 'review' => 'required', 'rating' => 'required|numeric', 'experience_id' => 'required|numeric');
     $validation = Validator::make($data, $rules);
     if ($validation->fails()) {
         return Redirect::to("/admin/expreviewadd")->withInput()->withErrors($validation);
     }
     $email = Input::get('email');
     $user_id = DB::table('users')->where('email', $email)->pluck('id');
     $review = Input::get('review');
     $rating = Input::get('rating');
     $show_review = Input::get('show_review');
     $product_id = Input::get('experience_id');
     $reservid = Input::get('reservid');
     $reservation_id_row = DB::select("select id from reservation_details where user_id = '{$user_id}' and reservation_type='experience' and id = '{$reservid}' order by id desc limit 0,1");
     if (!$reservation_id_row) {
         flash()->error('Reservation Detail ID do not match with Email.');
         return Redirect::to("/admin/expreviewadd")->withInput();
     }
     /*
     		$reservation_id_row = DB::select("select id from reservation_details where user_id = '$user_id' and product_id = '$product_id' and reservation_type='experience' order by id desc limit 0,1");
     		if(!$reservation_id_row){
     			flash()->error('Reservation Detail ID do not match with Email.');
     			return Redirect::to("/admin/expreviewadd")->withInput();
     		}
     		foreach($reservation_id_row as $row1)
     		{
     		  $reservid = $row1->id;
     		}*/
     if ($show_review == "") {
         $statusUpdate = "Pending";
     } else {
         $statusUpdate = "Approved";
     }
     $productReviews = new ProductReviews();
     $productReviews->product_id = $product_id;
     $productReviews->user_id = $user_id;
     $productReviews->reserv_id = $reservid;
     $productReviews->review = $review;
     $productReviews->rating = $rating;
     $productReviews->status = $statusUpdate;
     $productReviews->save();
     flash()->success('The Experience Review has been successfully Added.');
     return redirect('admin/review');
 }