devops/nova-map-address

一个 Laravel Nova 字段,可以在地图上放置标记以获取坐标,然后通过反向地理编码获取街道地址

安装: 481

依赖: 0

建议: 0

安全: 0

星星: 0

观察者: 1

分支: 1

开放问题: 0

语言:Vue

dev-master 2021-01-05 20:58 UTC

This package is auto-updated.

Last update: 2024-09-06 04:54:34 UTC


README

一个 Nova 字段,可以在地图上放置标记以获取坐标,然后通过反向地理编码获取街道地址

安装

您可以通过 composer 将此包安装到使用 Nova 的 Laravel 应用程序中

composer require devops/nova-map-address

laravel 支持

此包支持 laravel v 7 和 8,较旧版本的 laravel https://github.com/JoseVte/nova-map-address

配置

发布包配置文件

php artisan vendor:publish --provider="devops\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 密钥,可以创建一个应用程序并启用 Places API,然后创建凭据以获取 API 密钥 https://console.developers.google.com

用法

将以下内容添加到 Nova/{Model}.php 资源

use devops\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),
]

Package screenshot

信用

支持

许可

MIT 许可证 (MIT)。请参阅 许可证文件 了解更多信息。