Closed wivaku closed 6 years ago
The chain provider already does that -- it's purpose is to iterate through providers until it finds a result. This issue is specific to the chain provider, I would recommend opening this issue here: https://github.com/geocoder-php/Geocoder, but also do some code-diving to see how it works here: https://github.com/geocoder-php/chain-provider
Likely it isn't behaving as you need it to exactly, I would open an issue for that describes what you want it to do opposed to what it currently does.
(This repo is for the Laravel wrapper aspect only, I'm not directly involved with the core development.)
How do I list the names of the registered providers? I do not want to manually + hardcoded create that list based, but dynamically based on actually registered providers. I tried using
app('geocoder')->getProviders()
.dd()
shows them, but I do not seem to be able to access them. Using Laravel 5.6, geocoder-laravel v4.0.10.When using
dd()
the chain of providers is shown.When using
foreach
thechain
itself is returned.When using
dd()
on->first()
I see the array of providers.When using
foreach
nothing is returned.Background: trying to create a list like
['google_maps','opencage']
. This so can iterate through the registered providers (e.g. if a certain provider gave an incomplete result, then use the next provider in the list to complement the previous result). Was planning to do something like this: