PHP code example of antto1 / laravel-admin-latlong

1. Go to this page and download the library: Download antto1/laravel-admin-latlong library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

antto1 / laravel-admin-latlong example snippets



    'extensions' => [

        'latlong' => [

            // 是否开始这个组件,默认true
            'enable' => true,

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

            // 根据上面的选择,填写相应地图的api_key,api_key需要到相应的平台去自行申请
            'providers' => [

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

                'baidu' => [
                    'api_key' => 'xck5u2lga9n1bZkiaXIHtMufWXQnVhdx',
                ],

                'tencent' => [
                    'api_key' => 'VVYBZ-HRJCX-NOJ4Z-ZO3PU-ZZA2J-QPBBT',
                ],

                'amap' => [
                    'api_key' => '3693fe745aea0df8852739dac08a22fb',
                ],
            ]
        ]
    ]


$form->latlong('latitude', 'longitude', '经纬度选择');

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

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