adminui/adminui-address 问题修复 & 功能扩展

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

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

adminui/adminui-address

Composer 安装命令:

composer require adminui/adminui-address

包简介

A package for Admin UI address lookup from GetAddress.io

README 文档

README

Version 2.x - Vue JS

This package is built for use within the AdminUI Framework, However due to the needs across multiple systems it can be run on any Laravel 7+ project.

Requirements

Laravel 8 package
VueJS
GetAddress.io api key

Installation

composer require adminui/adminui-address

Once installed Laravel with auto-find the package.

This package uses Laravel HTTP class to get results from getaddress.io

The package does come with a Countries migration and seed and also a US State Migration and seed.
The Country table contains a few extra fields, iso codes, postcode requirement, dial code and status.
If the status is 0 it will not be selectable, hence restricting certain countries if need be.
If postcode is 1 the postcode field will be required.

Please run :

php artisan vendor:publish --tag adminui-address
php artisan migrate
php artisan db:seed --class=AdminUI\AdminUIAddress\Database\Seeds\DatabaseSeeder

Once done you will need to update the config file 'adminuiaddress' or add the following variables to the .env file:

AUI_ADDRESS_APIKEY=""
AUI_ADDRESS_ADMINKEY=""
AUI_ADDRESS_CACHETIME=""
AUI_ADDRESS_LNG=""
AUI_ADDRESS_LAT=""
AUI_UNIT="M"

The address component has been moved to your views/components folder.
And its JS for the blade component to public/vendor/adminui/address-block.js
It can be easily called using

@addressBlock()

If the UK is chosen it gives you the opportunity to do a postcode lookup. The lookup will appear in a dropdown if postcode is found. Once address is chosen a full address block appears.

The system uses Laravels caching to store postcode results, to save repeat lookups.

Please ensure to add in Jquery to your template. Also please add

@stack('scripts')

This will allow the required Javascript to be pushed below the Jquery call.

Distance Helper Class

The package comes with a distance helper class. This can calculate the distance from your 'lat/lng' (as per config) to the address you have just got from the postcode lookup script.

Simply call the class with the variables and measurement unit, and the resulting distance will be returned

use Distance;
...
$distance  =  round(Distance::between(['lng'  => request('lng'),  'lat'  => request('lat')]), 2);

This will take 3 parameters:
TO - array [lng, lat]
FROM - array[lng, lat] optional, by default this is lng and lat setup in env or config file

Distance can be returned in 3 units of measurement. M - Miles ** Default ** KM - Kilometers NM - Nautical Miles This can be set within the .env or directly in config file.

Distance is returned.

Credit given to :
altrozero/get-address-io-php
for some of the coding structure.

Still to come in next branch:
Add some Admin Functionality for Whitelist, Blacklist, Invoices

Enjoy.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-03-10

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固