本文整理汇总了PHP中app\City::getCityFromAutoComplete方法的典型用法代码示例。如果您正苦于以下问题:PHP City::getCityFromAutoComplete方法的具体用法?PHP City::getCityFromAutoComplete怎么用?PHP City::getCityFromAutoComplete使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\City
的用法示例。
在下文中一共展示了City::getCityFromAutoComplete方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: gmapsPost
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]);
}
示例2: showHotel
/**
* 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'));
}
示例3: store
/**
* 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']);
}
示例4: update
/**
* 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!']);
}
示例5: create
/**
* 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;
}