traineratwot/filament-openstreetmap 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

traineratwot/filament-openstreetmap

最新稳定版本:2.0.1

Composer 安装命令:

composer require traineratwot/filament-openstreetmap

包简介

This is my package filament-openstreetmap

README 文档

README

Latest Version on Packagist

Total Downloads

Add openstreetmap field to filament form

Full free map API

Interface

2024-01-19_09-54-03

How it view in database

NVIDIA_Share_Yn8wCeCsJf

Installation

You can install the package via composer:

composer require traineratwot/filament-openstreetmap

Usage

Make model with migration

return new class extends Migration {
    public function up(): void
    {
        Schema::create('points', function (Blueprint $table) {
            $table->id();
            $table->string('point')->nullable();
            $table->json('point_array')->nullable();
            $table->timestamps();
            $table->softDeletes();
        });
    }

    public function down(): void
    {
        Schema::dropIfExists('points');
    }
};
namespace App\Models;

use MatanYadaev\EloquentSpatial\Objects\Point;
use Illuminate\Database\Eloquent\Model;

class Point extends Model
{
    use SoftDeletes;

    protected $guarded = ['id'];

    protected function casts()
    {
        return [
            'point' => PointCast::class,
            'point_array' => PointCast::class . ':' . PointFormat::ARRAY->value ,
        ];
    }
}

Make filament resource

<?php

namespace App\Filament\Resources;

use Traineratwot\FilamentOpenStreetMap\Forms\Components\MapInput;


class MapPointResource extends Resource
{
    protected static ?string $model = MapPoint::class;

    public static function form(Schema $schema): Schema
    {
        return $schema
            ->components([
                MapInput::make('point')
                    ->columnSpan(2)
                    ->saveFormat(PointFormat::WKT)
                ,
                MapInput::make('point_array')
                    ->saveFormat(PointFormat::ARRAY)
                ,

                TextEntry::make('created_at')
                    ->label('Created Date')
                    ->dateTime(),

                TextEntry::make('updated_at')
                    ->label('Last Modified Date')
                    ->dateTime(),
            ]);
    }
}

formats

You can save in database in thar formats

foreach (PointFormat::cases() as $p){
   dump($p->getExample());
}

#   $point = new Point(55.7558, 37.6173);
#    return $point->format(PointFormat::URL_YANDEX);
"55.7558,37.6173" // app/Console/Commands/DevTestCommand.php:17
"37.6173,55.7558" // app/Console/Commands/DevTestCommand.php:17
"POINT(37.6173 55.7558)" // app/Console/Commands/DevTestCommand.php:17
"{"type":"Point","coordinates":[37.6173,55.7558]}" // app/Console/Commands/DevTestCommand.php:17
"55°45'20.88"N 37°37'2.28"E" // app/Console/Commands/DevTestCommand.php:17
"55.755800, 37.617300" // app/Console/Commands/DevTestCommand.php:17
"https://www.google.com/maps/search/?api=1&query=55.7558,37.6173" // app/Console/Commands/DevTestCommand.php:17
"https://www.openstreetmap.org/?mlat=55.7558&mlon=37.6173#map=15/55.7558/37.6173" // app/Console/Commands/DevTestCommand.php:17
"https://yandex.ru/maps/?pt=37.6173,55.7558&z=15&l=map" // app/Console/Commands/DevTestCommand.php:17
"{"latitude":55.7558,"longitude":37.6173}" // app/Console/Commands/DevTestCommand.php:17
"[37.6173,55.7558]" // app/Console/Commands/DevTestCommand.php:17

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.

Used packages

composer: matanyadaev/laravel-eloquent-spatial
npm: ol
npm: ol-geocoder

统计信息

  • 总下载量: 1.58k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 28
  • 点击次数: 4
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 28
  • Watchers: 1
  • Forks: 11
  • 开发语言: Blade

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-01-18

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固