i-prikot/moonshine-yandexmap
最新稳定版本:v1.0.0
Composer 安装命令:
composer require i-prikot/moonshine-yandexmap
包简介
YandexMap for MoonShine
关键字:
README 文档
README
A custom Yandex Maps field for MoonShine admin panel that allows users to interact with Yandex Maps, place markers, and save coordinates.
Features
- Interactive Yandex Maps integration
- Placemark management (add/delete)
- Configurable default map center and zoom level
Installation
-
Install the package via Composer:
composer require iprikot/moonshine-yandexmap
-
Publish the configuration file:
php artisan vendor:publish --tag=moonshine-yandexmap-config
-
Add your Yandex Maps API key to the
.envfile:MOONSHINE_YANDEXMAP_API_KEY=your_api_key_here
Usage
Basic Usage
use Iprikot\YandexMap\Fields\YandexMap; // In your MoonShine resource YandexMap::make('Location', 'location')
Customization Options
YandexMap::make('Location', 'location') ->width('100%') // or 500, '50vw', etc. ->height(400) // or '50vh', '30rem', etc. ->defaultMapCenter(56.023097, 92.874172) // latitude, longitude ->defaultMapZoom(13) ->defaultIconHEXColor('#0095b6') ->selectedIconHEXColor('#ff0000') ->deletePlacemarkButtonLabel('Remove marker') ->fitToBoundsButtonLabel('Fit to bounds');
Configuration
The package comes with a config file (moonshine_yandexmap.php) where you can set default values:
return [ 'api_key' => env('MOONSHINE_YANDEXMAP_API_KEY', ''), ];
Data Structure
The field stores data as JSON with the following structure:
{
"center": [56.023097, 92.874172],
"zoom": 13,
"placemarks": [[56.023097, 92.874172],[58.023097, 92.874172]]
}
Requirements
- PHP 8.0+
- MoonShine 3.0+
- Yandex Maps API 2.1
License
This package is open-sourced software licensed under the MIT license.
统计信息
- 总下载量: 6
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-04-16