/** * get the nearest locations by postcode * * @param string $postcode * @param string $model * @param integer $limit * @param integer $offset * @return array * @author Andy Bennett */ public function nearest_postcode_locations($postcode, $model, $limit = null, $offset = null) { $ll = latlon::latlon_from_postcode($postcode); if ($ll == false or empty($ll->latitude) or empty($ll->longitude)) { return false; } Kohana::config_set('distance.lat', $ll->latitude); Kohana::config_set('distance.lon', $ll->longitude); return ORM::factory($model)->where('status', 1)->find_all($limit, $offset); }