josrom / 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-22 03:02:15 UTC
README
一个Nova字段,用于在地图上放置标记以获取坐标,然后通过逆向地理编码坐标来获取街道地址
安装
您可以通过composer将此包安装到使用Nova的Laravel应用中
composer require josrom/nova-map-address
配置
发布包配置文件
php artisan vendor:publish --provider="Josrom\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创建应用并启用Places API来创建凭据以获取API密钥。
用法
将以下内容添加到Nova/{Model}.php资源文件中
use Josrom\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), ]
支持
- Jose Vicente Orts: vince@square1.io
许可证
MIT许可证(MIT)。有关更多信息,请参阅许可证文件。
