| @@ 117-131 (lines=15) @@ | ||
| 114 | return $this->aggregator->getName(); |
|
| 115 | } |
|
| 116 | ||
| 117 | public function geocode(string $value) : self |
|
| 118 | { |
|
| 119 | $cacheKey = str_slug(strtolower(urlencode($value))); |
|
| 120 | $this->results = app('cache')->remember( |
|
| 121 | "geocoder-{$cacheKey}", |
|
| 122 | config('geocoder.cache-duration', 0), |
|
| 123 | function () use ($value) { |
|
| 124 | return collect($this->aggregator->geocode($value)); |
|
| 125 | } |
|
| 126 | ); |
|
| 127 | ||
| 128 | $this->removeEmptyCacheEntry("geocoder-{$cacheKey}"); |
|
| 129 | ||
| 130 | return $this; |
|
| 131 | } |
|
| 132 | ||
| 133 | public function reverse(float $latitude, float $longitude) : self |
|
| 134 | { |
|
| @@ 133-147 (lines=15) @@ | ||
| 130 | return $this; |
|
| 131 | } |
|
| 132 | ||
| 133 | public function reverse(float $latitude, float $longitude) : self |
|
| 134 | { |
|
| 135 | $cacheKey = str_slug(strtolower(urlencode("{$latitude}-{$longitude}"))); |
|
| 136 | $this->results = app('cache')->remember( |
|
| 137 | "geocoder-{$cacheKey}", |
|
| 138 | config('geocoder.cache-duration', 0), |
|
| 139 | function () use ($latitude, $longitude) { |
|
| 140 | return collect($this->aggregator->reverse($latitude, $longitude)); |
|
| 141 | } |
|
| 142 | ); |
|
| 143 | ||
| 144 | $this->removeEmptyCacheEntry("geocoder-{$cacheKey}"); |
|
| 145 | ||
| 146 | return $this; |
|
| 147 | } |
|
| 148 | ||
| 149 | public function limit(int $limit) : self |
|
| 150 | { |
|