__("France"), "DE" => __("Germany"), "JP" => __("Japan"), "ES" => __("Spain"), "GB" => __("United Kingdom"), ]; } // Object methods public function hasGeolocation(): bool { return isset($this->latitude, $this->longitude); } public function geocode(): ?array { try { $results = Geolocation::geocode($this->postal_code); $result = $results[0]; $this->latitude = $result->geometry->location->lat; $this->longitude = $result->geometry->location->lng; return [$this->latitude, $this->longitude]; } catch(Exception $e) { return null; } } }