承接 zima/orchid-yandex-map 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

zima/orchid-yandex-map

最新稳定版本:1.0.0

Composer 安装命令:

composer require zima/orchid-yandex-map

包简介

Yandex map for site

关键字:

README 文档

README

The preferred way to install this extension is through composer.

Either run

php composer.phar require --prefer-dist zima/orchid-yandex-map "*"

or add

"zima/orchid-yandex-map": "*"

Publish config

php artisan vendor:publish --tag=yandex-map-config

Publish resources

php artisan vendor:publish --tag=yandex-map-resources

Publish lang files

php artisan vendor:publish --tag=yandex-map-lang

Usage

In html/.env file add keys YANDEX-MAP-KEY and YANDEX-SUGGEST-KEY

YANDEX-MAP-KEY=
YANDEX-SUGGEST-KEY=

In html/config/platform.php file find key "vite" and add rows like this

    'vite' => [
        ...,

        'resources/css/orchid-yandex-map/app.css',
        'resources/js/orchid-yandex-map/app.js',
    ],

In your database, coordinates should be stored as json, so create json column in your table, e.g:

    Schema::create('places', function (Blueprint $table) {
        ...
        $table->json('map')->nullable();
        ...
    });

In model:

class Place extends Model
{
    ```
    ```

    /**
     * The attributes that are mass assignable.
     *
     * @var array
     */
    protected $fillable = [
        ```
        ```
        'map',
    ];

    protected $casts = [
        ```
        ```
        'map' => 'json',
    ];
}

Well, now you are ready to use YMap field on your Orchid screens

    YMap::make('model.map')
        ->title(__('ymap.title'))
        ->help(__('ymap.help'))
        ->height('400px')               // height of map container, default 300px
        ->zoom(12)                      // map zoom, default 14
        ->center('30.314997,59.938784') // coordinates of center, default '37.588144,55.733842' (Moscow)
        ->controls([
            ControlType::GEOLOCATION,   // display or not geolocation (find me) control
            ControlType::SCALE,         // display or not scale control
            ControlType::SEARCH,        // display or not map search control
            ControlType::ZOOM,          // display or not zoom control
    ]),

Also you can hide map field and use suggest field only, or vise versa - use map included search without suggest field

# hide map

    YMap::make('model.map')
        ->title(__('ymap.title'))
        ->help(__('ymap.help'))
        ->hideMap(true)                 //to hide map field
    ),

# or hide suggest field

    YMap::make('model.map')
        ->title(__('ymap.title'))
        ->help(__('ymap.help'))
        ->hideSearch(true)              //to hide map field
        ->controls([
            ControlType::GEOLOCATION,   // display or not geolocation (find me) control
            ControlType::SCALE,         // display or not scale control
            ControlType::SEARCH,        // display or not map search control
            ControlType::ZOOM,          // display or not zoom control
    ]),

License

MIT license.

统计信息

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

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: JavaScript

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-09-22