siberfx/backpack-leafletjs
Composer 安装命令:
composer require siberfx/backpack-leafletjs
包简介
Leafletjs lat lng fields for Laravel Backpack ^6.x
README 文档
README
Installation
You can install the package via composer:
composer require siberfx/backpack-leafletjs
Usage
// config/leaflet.php file content, you can modify it by your own settings.
return [
'model_name' => App\Models\Setting::class,
'table_name' => 'settings',
'lat_field' => 'lat',
'lng_field' => 'lng',
'mapbox' => [
'access_token' => env('MAPS_MAPBOX_ACCESS_TOKEN', 'xxxxxxxxxxxxxxxxxxxxx'),
],
];
Publish files
php artisan vendor:publish --provider="Backpack\Leafletjs\LeafLetServiceProvider" --tag="migrations" #publish the migration file
php artisan vendor:publish --provider="Backpack\Leafletjs\LeafLetServiceProvider" --tag="config" #publish the config file
php artisan vendor:publish --provider="Backpack\Leafletjs\LeafLetServiceProvider" --tag="view_components" #publish the lang files
or
php artisan vendor:publish --provider="Backpack\Leafletjs\LeafLetServiceProvider" --tag="all"
Add Leaflet fields to your model
You can override in which table are located your "lat, lng" fields and even the model you want to create the fields with the help of config/backpack/leaflet.php file and table_name field if its set already
$fillable = [
'lat',
'lng',
...
];
or
config('backpack.leaflet.lat_field'), // or 'lat'
config('backpack.leaflet.lng_field') // or 'lng'
Call it inside your controller like this or
// Add LeafletFields trait to your Crud Controller
use Backpack\Leafletjs\Http\Controllers\Admin\Traits\LeafletCrud;
// and call if your using App\Model\Settings model as your instance:
$this->setLeafletFields();
// to add default fields
or add in your Crud controller manually where you want to see it as shown below.
$this->crud->addField([
'name' => 'leafletMapId', // this is not a name of field in database.
'type' => 'leaflet',
'model' => config('backpack.leaflet.model_name'), // you can modify under config folder or override by your own for each model
'options' => [
'provider' => 'mapbox', // default algolia map provider
'marker_image' => null // optional
],
'hint' => '<em>You can also drag and adjust your mark by clicking</em>'
]);
$this->crud->addField([
'name' => 'lat',
'type' => 'hidden',
'attributes' => ['id' => 'leafletMapId-lat'],
'tab' => 'General'
]);
$this->crud->addField([
'name' => 'lng',
'type' => 'hidden',
'attributes' => ['id' => 'leafletMapId-lng'],
'tab' => 'General'
]);
or
$this->crud->addField([
'name' => 'leafletMapId', // this is not a name of field in database.
'type' => 'leaflet',
'model' => config('backpack.leaflet.model_name'), // you can modify under config folder or override by your own for each model
'options' => [
'provider' => 'mapbox', // default algolia map provider
'marker_image' => null // optional
],
'autogenerate' => true, // if you dont want to create the fields in crud controller for lat and lng you specified, it generates himself.
' hint' => '<em>You can also drag and adjust your mark by clicking</em>'
]);
Security
If you discover any security related issues, please email info@siberfx.com instead of using the issue tracker.
Credits
siberfx/backpack-leafletjs 适用场景与选型建议
siberfx/backpack-leafletjs 是一款 基于 Blade 开发的 Composer 扩展包,目前已累计 24 次下载、GitHub Stars 达 0, 最近一次更新时间为 2023 年 02 月 22 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「mapbox」 「backpack」 「openstreetmaps」 「leafletjs」 「leafjs」 「laravel 10.x」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 siberfx/backpack-leafletjs 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 siberfx/backpack-leafletjs 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 siberfx/backpack-leafletjs 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
More information available at https://pear.php.net/package/Services_OpenStreetMap
Show geo marker on a mapbox map
Show geo shape on a mapbox map with drawing capabilities
Generate a Yandex,Google,MapBox,Bing,CartoDB,HERE,MapQuest static map with Static Map Maker
Extended summernote fields for laravel backpack
Maps integration for Neos CMS. Stadiamaps, Protomaps, Openstreetmaps or GoogleMaps. Live preview. Multiple addresses.
统计信息
- 总下载量: 24
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 23
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-02-22