trinityrank/geo-location
Composer 安装命令:
composer require trinityrank/geo-location
包简介
GeoLocation - show or hide operaters in selected countries
README 文档
README
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
其他信息
- 授权协议: MIT
- 更新时间: 2021-10-20