rajibbinalam / country-state-city
查找全球各国、州和城市
v0.2.0
2023-04-07 14:16 UTC
Requires
- php: ^8.1
- illuminate/contracts: ^10.0
- spatie/laravel-package-tools: ^1.14.0
Requires (Dev)
- laravel/pint: ^1.0
- nunomaduro/collision: ^7.9
- nunomaduro/larastan: ^2.0.1
- orchestra/testbench: ^8.0
- pestphp/pest: ^2.0
- pestphp/pest-plugin-arch: ^2.0
- pestphp/pest-plugin-laravel: ^2.0
- phpstan/extension-installer: ^1.1
- phpstan/phpstan-deprecation-rules: ^1.0
- phpstan/phpstan-phpunit: ^1.0
- spatie/laravel-ray: ^1.26
This package is auto-updated.
Last update: 2024-09-09 23:04:59 UTC
README
此包为您提供关于国家、州和城市名称及其一些本地信息的全球信息
安装
您可以通过composer安装此包
composer require rajibbinalam/country-state-city
发布供应商文件:找到以下文件
- config > CountryStateCity.php
- database > migrations > country, state, city 和 timezone
- database > seeders > country, state, city 和 timezone
php artisan vendor:publish
# Provider: rajib\LaravelCountryStateCity\CountryStateCityServiceProvider
配置迁移表名称和字段
return [ /* |-------------------------------------------------------------------- | Configaration Your Migrations. |---------------------------------------------------------------- | Set the table_name or use default LIKE: 'table_name' => 'countries', |---------------------------------------------------------------- | 'required' => true, will be added to the migration as a field |--------------------------------------------------------------------- */ 'migrations' => [ 'countries' => [ 'table_name' => 'countries', 'optional_fields' => [ 'phone_code' => [ 'required' => true, 'length' => 5, ], 'iso3' => [ 'required' => false, 'length' => 3, ], ], ], ], ];
迁移
php artisan migrate
数据库播种
将播种器文件注册到您的 DatabaseSeeder.php
并运行播种命令
$this->call([ CountryTableSeeder::class, StateTableSeeder::class, CityTableSeeder::class, TimezoneTableSeeder::class, ]);
php artisan db:seed # it's need some time to seed the database
贡献
我们将尊重您的贡献。请参阅CONTRIBUTING以获取详细信息。
鸣谢
许可
MIT许可(MIT)。请参阅许可文件以获取更多信息。