public static function getRegions($continentString) { $regions = Region::where('continent', '=', $continentString)->get(); return $regions; }
/** * 获取区域信息 * * @return Response */ public function getRegion($regionID, $regionLevel) { $shopRegions = Region::where('wy_region_parentid', $regionID)->where('wy_region_level', $regionLevel)->get(array('wy_region_id', 'wy_region_name', 'wy_region_parentid', 'wy_region_shortname')); if (empty($shopRegions->toArray())) { return View::make('admin.manage.shop.shopregion')->withError(Lang::get('errormessages.-10041')); } else { return View::make('admin.manage.shop.shopregion', compact('shopRegions')); } }
/** * @param $nation_id * @return mixed */ public static function listRegionsOneNation($nation_id) { return Region::where('nation_id', '=', $nation_id)->lists('libelle', 'id'); }
<?php Route::group(['prefix' => 'ajax'], function () { # SelectBox Nations Route::post('sbNations', function () { $results = Nation::all(); $code = ''; foreach ($results as $result) { $code .= '<option value="' . $result->id . '">' . $result->libelle . '</option>'; } return $code; }); # SelectBox Regions Route::post('sbRegions/{nation_id}', function ($nation_id) { $results = Region::where('nation_id', '=', $nation_id)->get(); $code = ''; foreach ($results as $result) { $code .= '<option value="' . $result->id . '">' . $result->libelle . '</option>'; } return $code; }); # SelectBox Clubs Route::post('sbClubs/{region_id}', function ($region_id) { $results = Club::where('region_id', '=', $region_id)->get(); $code = ''; foreach ($results as $result) { $code .= '<option value="' . $result->id . '">' . $result->nom . '</option>'; } return $code; }); # LoadPage
/** * AJAX response for autocomplete of regions. */ public function getRegions() { $matches = array(); $regions = Region::where('regionName', 'LIKE', '%' . Input::get('term') . '%')->get(); foreach ($regions as $region) { $matches[] = '{"label":"' . $region->regionName . '","value":"' . $region->regionID . '"}'; } echo '[' . implode(',', $matches) . ']'; }