专家 / nova-map-address
一个Laravel Nova字段,可以在地图上放置标记以获取坐标,然后将其反向地理编码以获取街道地址
0.1.0
2019-11-21 16:10 UTC
Requires
- php: >=7.1.0
- illuminate/support: ^5.7|^6.0
This package is auto-updated.
Last update: 2024-09-12 14:52:31 UTC
README
一个Nova字段,可以在地图上放置标记以获取坐标,然后将其反向地理编码以获取街道地址
安装
您可以通过composer将此包安装到使用Nova的Laravel应用程序中
composer require specialist/nova-map-address "dev-master"
## Configuration
Publish the package config file:
```bash
php artisan vendor:publish --provider="Specialist\MapAddress\FieldServiceProvider"
这是将在config/map-address.php中发布的文件内容。
将以下键添加到您的.env
和.env.example
MAP_ADDRESS_API_KEY=
Optional: Set map and address language
MAP_ADDRESS_LANGUAGE=es
如果您需要Google Maps API密钥,可以在https://console.developers.google.com创建应用程序并启用地点API,以创建凭据以获取API密钥。
用法
将以下内容添加到Nova/{Model}.php资源中
use Specialist\MapAddress\MapAddress; [ MapAddress::make('address'), // You can set the initial map location. By default (Spain) MapAddress::make('address') ->initLocation(38.261842, -0.6868031), // You can set the location from the model MapAddress::make('address') ->setLocation($this->latitude, $this->longitude), // You can select the name of lat/lng fields. By default is lat/lng MapAddress::make('address') ->setLatitudeField('latitude') ->setLongitudeField('longitude'), // You can select what is the first result set in address field MapAddress::make('address') ->setGoogleResultType('street_address'), // You can also set the map zoom level. By default (4) MapAddress::make('address') ->initLocation(38.261842, -0.6868031) ->zoom(12), ]
支持
- Specilaist001: darking-uz@yandex.com
许可证
MIT许可证(MIT)。有关更多信息,请参阅许可证文件。