wm/map-point-nova3

Laravel Nova 字段。

v0.0.9 2023-03-31 12:42 UTC

This package is auto-updated.

Last update: 2024-09-30 01:52:19 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.json "repositories" 数组属性中添加

        {
            "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

您可以在地图上显示和编辑一个地理点(Point,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 类而不是数组来表示您的标签页。