trinityrank/geo-location 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

trinityrank/geo-location

Composer 安装命令:

composer require trinityrank/geo-location

包简介

GeoLocation - show or hide operaters in selected countries

README 文档

README

Latest Version on Packagist Total Downloads

Choose to show or hide Operaters by choosing the countries from list.

Installation

Step 1: Install package

To get started with Laravel Geo Location, use Composer command to add the package to your composer.json project's dependencies:

    composer require trinityrank/geo-location

Step 2: Migration

  • You need to publish migration from package
    php artisan vendor:publish --provider="Trinityrank\GeoLocation\GeoLocationServiceProvider" --tag="geolocation-migration"
  • And then you need to run migration for alltenant(s)
    php artisan tenant:artisan "migrate"
  • Or only for one speciffic tenant
    php artisan tenant:artisan "migrate" --tenant=[--TENANT-ID--]

Step 3: Operaters Model database

Add this fields to '$fillable' inside Operaters model

    public $fillable = [
        ...
        'geolocation_option',
        'geolocation_countries',
    ];

Step 4: Add field

  • Add field to your (Operater) resource into "fields" method
    use Trinityrank\GeoLocation\GeoLocationPanel;
    
    ...
    
    GeoLocationPanel::make()
  • Or if you use conditional fields than just add this into "fields" method
    $this->getGeoLocationPanel('GeoLocation Page Settings', 'geolocation')

Step 5: If you are using conditional fields

Add this in tenant config

    'conditional_fields' => [
        ...

        'operater' => [
            'geolocation' => [
                'visible' => true
            ]
        ]

        ...
    ]

Step 6: Frontend part

  • Without token
    use Trinityrank\GeoLocation\GeoLocationOperater;

    ...

    $operaters = GeoLocationOperater::list($operaters_array);
  • With token

Add new variable in .ENV file

    GEOLOCATION_API_TOKEN=[--Replace-this-with-website-token--]

You can connect with 'config/main.php' file

    'geolocation_api_token' => env('GEOLOCATION_API_TOKEN', null),

Then we can use our Geo Location

    use Trinityrank\GeoLocation\GeoLocationOperater;

    ...

    $operaters = GeoLocationOperater::list($operaters_array, $api_token = [optional]);

统计信息

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

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-10-20

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固