Esempio n. 1
0
 public function query($query)
 {
     $query = strtolower(filter_var($query, FILTER_SANITIZE_STRING));
     $cities_raw = City::all();
     $cities = array();
     if (!empty($cities_raw)) {
         foreach ($cities_raw as $city) {
             $city_name = strtolower($city->name);
             if (strstr($city_name, $query)) {
                 $city = array('value' => $city->name . ', ' . $city->country->name . ' (' . $city->country->code . ')');
                 $cities[] = $city;
             }
         }
     }
     return json_encode($cities);
 }
Esempio n. 2
0
 /**
  * Get the city associated with this Air Offer.
  */
 public function city($city_code)
 {
     return City::where('code', $city_code)->get();
 }
Esempio n. 3
0
 public function address_content(Request $request)
 {
     $usermeta = UserMeta::where('user_id', Sentinel::getUser()->id)->where('meta_key', 'address')->first();
     $address = unserialize($usermeta->meta_value);
     $this->data['address'] = $address[$request->id];
     $this->data['province'] = Province::where('id', $this->data['address']['provinsi'])->first();
     $this->data['district'] = District::where('id', $this->data['address']['kecamatan'])->first();
     $this->data['city'] = City::where('id', $this->data['address']['kota'])->first();
     $this->data['weight'] = $request->weight;
     $costs = app('App\\Http\\Controllers\\OrderController')->get_cost($this->data['address']['kota']);
     $cost = json_decode($costs);
     $this->data['cost_data'] = serialize($cost->rajaongkir->results[0]->costs);
     return view('address_content')->with('data', $this->data);
 }
Esempio n. 4
0
 public function city_content(Request $request)
 {
     $this->data['city_data'] = City::where('id_province', $request->id)->get();
     return view('city_content')->with('data', $this->data);
 }