oriatec/laravel-insee-localisation

用于导入和使用Insee位置数据的包

v1.0.2 2021-08-25 12:48 UTC

This package is auto-updated.

Last update: 2024-09-27 18:08:05 UTC


README

本包提供了一种使用导入命令实现Insee法国位置数据的方法

安装

添加ORIATEC私有Packagist仓库

composer config repositories.private-packagist composer https://repo.packagist.com/oriatec/

安装包

composer require oriatec/laravel-insee-localisation

运行迁移

php artisan migrate

使用

导入Insee数据

要导入Insee数据,请运行

php artisan insee:import

在您的应用程序中使用这些数据

模型LocalisationCity

表示一个城市,包括所有信息、部门和地区。

模型LocalisationDepartment

表示一个部门,包括所有信息和地区

模型LocalisationRegion

表示一个地区

Eloquent模型Localisation

是用于请求数据库的Eloquent模型。

它提供静态方法来生成LocalisationCity、LocalisationDepartment或LocalisationRegion

use ORIATEC\InseeLocalisation\Models\Localisation;

// Random Localisation
$city = Localisation::randomCity();
$department = Localisation::randomDepartment();
$region = Localisation::randomRegion();

// Localisation Check
Localisation::cityIsInDepartment($zipcode, $department_code);
Localisation::cityIsInRegion($zipcode, $region_code);
Localisation::departmentIsInRegion($department_code, $region_code);

// City 
$cities = Localisation::cities();
$cities = Localisation::citiesInDepartment($department_code);
$cities = Localisation::citiesInRegion($region_code);

$city = Localisation::city($zipcode);

// Department
$departments = Localisation::departments();
$departments = Localisation::departmentsInRegion($region_code);
$department = Localisation::department($department_code);
$department = Localisation::departmentForCity($zipcode);

// Region

$regions = Localisation::regions();
$region = Localisation::region();
$region = Localisation::regionForDepartment($department_code);
$region = Localisation::regionForCity($zipcode);

变更日志

请参阅changelog.md了解最近的变化。

许可证

本包属于ORIATEC SARL。您必须获得授权才能使用它。