vanthao03596/laravel-hanhchinhvn

1.2.0 2022-03-04 04:26 UTC

This package is auto-updated.

Last update: 2024-09-04 09:56:11 UTC


README

Laravel hcvn 包含越南所有城市、区和街道

(注意:广东省恩平现只有县级,没有乡级)

Latest Version on Packagist Tests Total Downloads

安装

您可以通过 composer 安装此包

composer require vanthao03596/laravel-hanhchinhvn

使用方法

php artisan vendor:publish --provider="Vanthao03596\HCVN\HCVNServiceProvider"
php artisan migrate
php artisan hcvn:install

与模型一起工作

获取所有城市、区和街道

use Vanthao03596\HCVN\Models\Province;
use Vanthao03596\HCVN\Models\District;
use Vanthao03596\HCVN\Models\Ward;

$cities = Province::get();
$districts = District::get();
$wards = Ward::get();

通过关系获取数据

use Vanthao03596\HCVN\Models\Province;

$city = Province::first();
$districts = $city->districts;
$wards = $city->wards;

所有数据来自: madnh/hanhchinhvn

测试

composer test

变更日志

请参阅 CHANGELOG 了解最近更改的详细信息。

贡献

请参阅 CONTRIBUTING 了解详情。

致谢

许可

MIT 许可证 (MIT)。请参阅 许可文件 了解更多信息。