/** * Store a newly created resource in storage. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ public function store(Request $request) { $input = $request->all(); // Format phone number. Ex: (+84) 909787874 $input['phone'] = '(' . $input['phoneCode'] . ')' . $input['phone']; // Format date for database insert $input['arrival_date'] = date('Y-m-d', strtotime($input['arrival_date'])); $input['departure_date'] = date('Y-m-d', strtotime($input['departure_date'])); // Format hotel room refernce for saving $single = $input['single']; $double = $input['double']; $twin = $input['twin']; $triple = $input['triple']; $input['hotel_room_reference'] = json_encode(compact('single', 'double', 'twin', 'triple')); $booking = TourBooking::create($input); // Send email to customer Mail::send('email.booking', $input, function ($message) use($input) { $message->from('*****@*****.**', 'Akjra Vu'); $message->to($input['email'])->subject(Config::get('myconfig.SITE_NAME') . ' - Booking!'); }); Session::flash('request_message', 'Your request has been sent successfully. Thank you!'); $booking = TourBooking::findOrFail($booking->id); // hard code alias for testing return view('booking.step3', ['booking' => $booking, 'tour' => Tour::find($input['tour_id'])]); }
/** * Ajax Update the specified to be published or unpublished. * * @return echo out result */ public function setActiveStatus() { $data = Input::all(); if (Request::ajax()) { $id = Input::get('id'); $tour = Tour::find($id); $tour->active = $data['active']; $tour->update(); echo $data['active']; } }
public function updatetour(Request $request, $id) { $validator = $this->validator($request->all()); if ($validator->fails()) { $this->throwValidationException($request, $validator); } $tour = Tour::find($id); $tour->owner = $request->input('owner'); $tour->nombre = $request->input('nombre_tour'); $tour->descripcion = $request->input('descripcion'); $tour->max_pax = $request->input('max_pax'); $tour->min_pax = $request->input('min_pax'); $tour->categoria = $request->input('categoria'); $tour->otra_categoria = $request->input('otra_categoria'); $tour->duracion = $request->input('duracion'); $tour->estado = $request->input('pais'); $tour->municipio = $request->input('estado'); $tour->localidad = $request->input('ciudad'); $tour->direccion = $request->input('direccion'); $tour->latitud = $request->input('latitud'); $tour->longitud = $request->input('longitud'); $tour->cp = $request->input('codigo_postal'); $tour->otros = $request->input('otros'); $incluye = $request->input('incluye'); $tour->save(); $tourid = $tour->id; $this->saveeditincluye($tourid, $incluye); return redirect()->route('mis_servicios'); $tour->save(); $tourid = $tour->id; $this->saveeditincluye($tourid, $incluye); return redirect()->route('mis_servicios'); }