Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
z-song authored Apr 19, 2019
1 parent 71261c9 commit 4671ff0
Showing 1 changed file with 19 additions and 13 deletions.
32 changes: 19 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
经纬度选择器
Latitude and longitude selector
======

这个扩展用来帮助你在form表单中选择经纬度,用来替代`Laravel-admin`中内置的`Form\Field\Map`组件, 组件支持的地图包括`Google map``百度地图``高德地图``腾讯地图``Yadex map`.

This extension is used to help you select the latitude and longitude in the form, which is used to replace the `Laravel-admin` built in `Form\Field\Map` component. The supported maps include `Google map`, `Baidu map`, `AMap`, `Tencent Map`, `Yadex map`.

## Installation

```bash
Expand All @@ -11,26 +13,30 @@ composer require laravel-admin-ext/latlong -vvv

## Configuration

打开config/admin.php,按照你的情况在extensions部分加上如下的配置:
Open `config/admin.php` and add the following configuration to the extensions section:

```php

'extensions' => [

'latlong' => [

// 是否开始这个组件,默认true
// Whether to enable this extension, defaults to true
'enable' => true,

// 选择下面指定的provider
'default' => 'yandex',
// Specify the default provider
'default' => 'google',

// 根据上面的选择,填写相应地图的api_key,api_key需要到相应的平台去自行申请
// According to the selected provider above, fill in the corresponding api_key
'providers' => [

'google' => [
'api_key' => '',
],

'yadex' => [
'api_key' => '',
],

'baidu' => [
'api_key' => 'xck5u2lga9n1bZkiaXIHtMufWXQnVhdx',
Expand All @@ -51,15 +57,15 @@ composer require laravel-admin-ext/latlong -vvv

## Usage

假设你的表中有两个字段`latitude``longitude`分别表示纬度和经度,那么在表单中使用如下:
Suppose you have two fields `latitude` and `longitude` in your table that represent latitude and longitude, then use the following in the form:
```php
$form->latlong('latitude', 'longitude', '经纬度选择');
$form->latlong('latitude', 'longitude', 'Position');

// 设置地图高度
$form->latlong('latitude', 'longitude', '经纬度')->height(500);
// Set the map height
$form->latlong('latitude', 'longitude', 'Position')->height(500);

// 设置默认值
$form->latlong('latitude', 'longitude', '经纬度')->default(['lat' => 90, 'lng' => 90]);
// Set default position
$form->latlong('latitude', 'longitude', 'Position')->default(['lat' => 90, 'lng' => 90]);
```

## Donate
Expand All @@ -70,4 +76,4 @@ $form->latlong('latitude', 'longitude', '经纬度')->default(['lat' => 90, 'lng

License
------------
Licensed under [The MIT License (MIT)](LICENSE).
Licensed under [The MIT License (MIT)](LICENSE).

0 comments on commit 4671ff0

Please sign in to comment.