public function registerhotel(Request $request) { $validator = $this->validator($request->all()); if ($validator->fails()) { $this->throwValidationException($request, $validator); } $hotel = new Hotel(); $hotel->owner = $request->input('owner'); $hotel->name = $request->input('name'); $hotel->estrellas = $request->input('estrellas'); $hotel->descripcion = $request->input('descripcion'); $hotel->otros_serv = $request->input('otros_serv'); $hotel->otras_nec = $request->input('otras_nececidades'); $hotel->otro_plan = $request->input('otro_plan'); $hotel->estado = $request->input('pais'); $hotel->municipio = $request->input('estado'); $hotel->localidad = $request->input('ciudad'); $hotel->direccion = $request->input('direccion'); $hotel->latitud = $request->input('latitud'); $hotel->longitud = $request->input('longitud'); $hotel->cp = $request->input('codigo_postal'); $hotel->id_galeria = $this->creategallery(); $servicios = $request->input('servicios'); // $planes = $request->input('planes'); $necesidades = $request->input('necesidades'); $hotel->save(); $hotelid = $hotel->id; $this->storestuff($hotelid); $this->saveservicios($hotelid, $servicios); // $this->saveplanes($hotelid, $planes); $this->savenecesidades($hotelid, $necesidades); return redirect()->route('mis_servicios'); }
public function run() { DB::table('hotels')->delete(); $faker = Faker\Factory::create(); for ($i = 0; $i < 5; $i++) { $hotel = new Hotel(); $hotel->hotel_name = $faker->text(20); $hotel->pos = $faker->latitude . ',' . $faker->longitude; $hotel->tips = $faker->text(20); $hotel->save(); // DB::table('hotels')->insert([ // 'hotel_name' => $faker->text(20), // 'pos' => $faker->latitude.','.$faker->longitude, // 'tips' => $faker->text(20) // ]); } }
public function postInsert() { //load data from ajax request and save to the database if (Request::ajax()) { $name = Input::get('name'); $address_line1 = Input::get('address_line1'); $address_line2 = Input::get('address_line2'); $city_id = Input::get('city'); $hotel = new Hotel(); $hotel->name = $name; $hotel->address_line1 = $address_line1; $hotel->address_line2 = $address_line2; $hotel->city_id = $city_id; $hotel->save(); $response = array('status' => 'success', 'msg' => 'Setting created successfully'); return 'Hotel is added successfully'; } else { return 'no'; } }
public function checkIn(Request $request) { $hotel_data = $request->input('hotel'); $transpo_data = $request->input('transpo'); $token = $request->input('token'); // $inputs = $request->all(); // return response()->json($inputs); $current_iterinary = UserSessionHandler::getUserCurrentIterinary($token); $response = UserSessionHandler::resolveNewSegmentFromActivity($token, $transpo_data, $hotel_data); $day = UserSessionHandler::getDiffInDays($token, $current_iterinary->id); $activity = new Activity(); $activity->start_time = Carbon::now()->toTimeString(); $activity->iterinary_id = $current_iterinary->id; $activity->day = $day; $hotel = new Hotel(); $hotel->place_name = $hotel_data['place_name']; $hotel->lng = $hotel_data['lng']; $hotel->lat = $hotel_data['lat']; if (isset($hotel['foursquare_id'])) { $hotel->foursquare_id = $hotel_data['foursquare_id']; } $hotel->save(); $hotel->activity()->save($activity); return response()->json($hotel); }
/** * @param $token * @param $hotel_data * @param $transpo * @return array|\Illuminate\Http\JsonResponse */ public static function addHotel($token, $hotel_data, $transpo) { $response = UserSessionHandler::resolveNewSegmentFromActivity($token, $transpo, $hotel_data); // return response()->json($response); if ($response) { return $response; } $current_iterinary = UserSessionHandler::getUserCurrentIterinary($token); $day = UserSessionHandler::getDiffInDays($token, $current_iterinary->id); $activity = new Activity(); $activity->start_time = Carbon::now()->toTimeString(); $activity->iterinary_id = $current_iterinary->id; $activity->day = $day; $hotel = new Hotel(); $hotel->place_name = $hotel_data['place_name']; $hotel->lng = $hotel_data['lng']; $hotel->lat = $hotel_data['lat']; $hotel->tips = $hotel_data['review']; $hotel->price = $hotel_data['price']; $hotel->foursquare_id = !$hotel_data['foursquare_id'] ? null : $hotel_data['foursquare_id']; $hotel->pic_url = ''; // return response()->json($eat); $hotel->save(); $hotel->activity()->save($activity); $iterinary = Iterinary::findOrFail($current_iterinary->id)->with('activities.typable')->first(); return response()->json($hotel, 200); }
public function addHotelTest(Request $request) { $request = $request->all(); $food_data = $request['hotel']; $token = $request['token']; $transpo = $request['transpo']; $response = UserSessionHandler::resolveNewSegmentFromActivity($token, $transpo, $food_data); // return response()->json($response); $current_iterinary = UserSessionHandler::getUserCurrentIterinary($token); $day = UserSessionHandler::getDiffInDays($token, $current_iterinary->id); $activity = new Activity(); $activity->start_time = Carbon::now()->toTimeString(); $activity->iterinary_id = $current_iterinary->id; $activity->day = $day; $hotel = new Hotel(); $hotel->hotel_name = $food_data['place_name']; $hotel->lng = $food_data['lng']; $hotel->lat = $food_data['lat']; $hotel->tips = $food_data['review']; $hotel->price = $food_data['price']; $hotel->pic_url = ''; // return response()->json($eat); $hotel->save(); $hotel->activity()->save($activity); $iterinary = Iterinary::findOrFail($current_iterinary->id)->with('activities.typable')->first(); return response()->json($iterinary, 200); }