Exemplo n.º 1
0
 public function gmapsPost()
 {
     $data = $this->request->all();
     if ($data['city_id']) {
         $city_id = City::getCityFromAutoComplete($data['city_id']);
         $city = City::find($city_id);
         $long = $city->long;
         $lat = $city->lat;
     } else {
         $long = $data['long'];
         $lat = $data['lat'];
     }
     isset($data['marker']) ? $marker = 1 : ($marker = 0);
     return redirect()->route('gmaps.get.coords', [$lat, $long, $marker]);
 }
Exemplo n.º 2
0
 /**
  * show one hotel, based on a city
  * @param $id
  *
  * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
  */
 public function showHotel($id)
 {
     $hotel_id = City::getCityFromAutoComplete($id);
     $hotels = AgodaHotel::where('hotel_id', $hotel_id)->paginate();
     $hotel_list = AgodaHotel::where('hotel_id', $id)->get(['hotel_name', 'url', 'city']);
     $city = $hotel_list->first()->city;
     $price_range = [0, 10000];
     //todo: make a proper one hotel page
     return view('agoda.show_city', compact('city', 'price_range', 'hotels', 'hotel_list'));
 }
Exemplo n.º 3
0
 /**
  * Update an existing ad
  *
  * @param $id
  *
  * @return \Illuminate\Http\RedirectResponse
  */
 public function store($id)
 {
     $classified = Classified::whereId($id)->first();
     Helper::allow('classified-edit', $classified);
     $classified = new Classified($this->request->all());
     $classified->city_id = City::getCityFromAutoComplete($classified->city_id);
     if ($location = $this->_uploadPicture()) {
         $classified->location = $location;
     }
     $classified->barangay_id = $this->_checkBarangay();
     $classified->send_mail = $this->SendMail();
     $classified->whereId($id)->update($classified->toArray());
     return redirect(route('classified.show', [$classified->city->province->slug, $classified->city->slug, $id]))->with(['success' => 'Your classified add has been updated']);
 }
Exemplo n.º 4
0
 /**
  * Update the specified resource in storage.
  *
  * @param  int $id
  *
  * @return \Illuminate\Http\Response
  */
 public function update($id)
 {
     $this->site = Site::whereId($id)->first();
     Helper::allow('site-edit', $this->site);
     $this->site = new Site($this->request->all());
     $this->site->id = $id;
     $this->site->city_id = City::getCityFromAutoComplete($this->site->city_id);
     $this->_requestFormCheck();
     $this->site->barangay_id = $this->_checkNewBarangay($this->request, $this->site);
     $this->_putCategories();
     $this->site->can_comment = isset($this->site->can_comment);
     $this->site->auto_comments = isset($this->site->auto_comments);
     unset($this->site->categories);
     DB::table('sites')->where('id', $id)->update($this->site->toArray());
     //$this->_fileUploaded();
     return redirect(route('sites.index'))->with(['success' => 'Your business ' . $this->site->name . ' has been updated!']);
 }
Exemplo n.º 5
0
 /**
  * Create a new user instance after a valid registration.
  * Info: I changed this from update to updateOrCreate for updates
  *
  * @param array $data
  *
  * @return \Illuminate\Database\Eloquent\Model
  */
 protected function create(array $data)
 {
     if (isset($data['city_id'])) {
         $city_id = City::getCityFromAutoComplete($data['city_id']);
     } else {
         $city_id = '';
     }
     $user = User::updateOrCreate(['username' => $data['username'], 'slug' => str_slug($data['username']), 'email' => $data['email'], 'password' => bcrypt($data['password'])]);
     UserDetail::updateOrCreate(['user_id' => $user->id, 'city_id' => $city_id]);
     Email::sendWelcomeEmail($user);
     return $user;
 }