musabgaili / filament-openstreetmap-mod
这是我创建的包:filament-openstreetmap
dev-main
2024-08-19 18:01 UTC
Requires
- php: ^8.1
- filament/filament: ^3.2
- filament/forms: ^3.2
- illuminate/contracts: ^10.0|^11.0
- matanyadaev/laravel-eloquent-spatial: ^3.0|^4.0
- spatie/laravel-package-tools: ^1.15.0
Requires (Dev)
- nunomaduro/collision: ^7.9|^8.0
- orchestra/testbench: ^8.0|^9.0
- pestphp/pest: ^2.0
- pestphp/pest-plugin-arch: ^2.0
- pestphp/pest-plugin-laravel: ^2.0
This package is not auto-updated.
Last update: 2024-10-01 16:54:33 UTC
README
将openstreetmap字段添加到filament表单
完整的免费地图API
接口
如何在数据库中查看
安装
您可以通过composer安装此包
composer require traineratwot/filament-openstreetmap
使用方法
使用迁移创建模型
return new class extends Migration { public function up(): void { Schema::create('map_points', function (Blueprint $table) { $table->id(); $table->point('point')->nullable(); // for Point type in Laravel 10 $table->geography('point', 'point', 0)->nullable(); // for Point type in Laravel 11 $table->string('point_string')->nullable(); // for String type $table->json('point_array')->nullable(); // for Array type $table->timestamps(); }); } public function down(): void { Schema::dropIfExists('map_points'); } };
namespace App\Models; use MatanYadaev\EloquentSpatial\Objects\Point; use Illuminate\Database\Eloquent\Model; class MapPoint extends Model { protected $casts = [ 'point' => Point::class, // Important for Point type 'point_array' => 'array', // Important for Array type ]; ... }
创建filament资源
<?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(Form $form): Form { return $form ->schema([ MapInput::make('point') ->saveAsPoint() // Important for Point type ->srid(4326) // Change srid for Point ->placeholder('Choose your location') ->coordinates(37.619, 55.7527) // start coordinates ->rows(10) // height of map , MapInput::make('point_string') ->saveAsString() // default ->placeholder('Choose your location') ->coordinates(37.619, 55.7527) // start coordinates ->rows(10) // height of map , MapInput::make('point_array') ->saveAsArray() // Important for Array type ->placeholder('Choose your location') ->coordinates(37.619, 55.7527) // start coordinates ->rows(10) // height of map , ]); } ... }
变更日志
请参阅CHANGELOG以获取最近更改的详细信息。
贡献
请参阅CONTRIBUTING以获取详细信息。
安全漏洞
请查看我们的安全策略,了解如何报告安全漏洞。
鸣谢
许可协议
MIT许可协议(MIT)。请参阅许可文件以获取更多信息。
使用的包
composer: matanyadaev/laravel-eloquent-spatial
npm: ol
npm: ol-geocoder