wm/map-point

一个Laravel Nova字段。

v0.0.10 2024-08-20 13:22 UTC

README

Map Point, awesome resource field for Nova

Version

要求

  • php: ^8
  • laravel/nova: ^4

安装

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

composer require wm/map-point

开发

在您希望进行开发的项目的根目录下创建一个nova-components文件夹。在内部克隆map-point。在composer.jsonrepositories数组属性中添加

        {
            "type": "path",
            "url": "./nova-components/map-point"
        }

修改composer.json中的requires对象属性

    "wm/map-point": "*",

在字段托管仓库内部运行

    cd vendor/laravel/nova && npm install

我们需要修改composer.lock文件运行

    composer update wm/map-point

在字段内部运行

    npm install

用法

地图点

image

您可以在地图上显示和编辑一个地理信息点(点,4326)的帖子

    use Wm\MapPoint\MapPoint;
    /**
     * Get the fields displayed by the resource.
     *
     * @param  \Laravel\Nova\Http\Requests\NovaRequest  $request
     * @return array
     */
    public function fields(NovaRequest $request)
    {
        return [
            ID::make()->sortable(),
                ...
            MapPoint::make('geometry')->withMeta([
                'center' => [42, 10],
                'attribution' => '<a href="https://webmapp.it/">Webmapp</a> contributors',
                'tiles' => 'https://api.webmapp.it/tiles/{z}/{x}/{y}.png',
                'minZoom' => 8,
                'maxZoom' => 17,
                'defaultZoom' => 13
            ]),
        ];
    }

配置

从v1.4.0版本开始,您可以使用Tab类而不是数组来表示您的标签页。