elsayed85/laravel-country-state-city 问题修复 & 功能扩展

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

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

elsayed85/laravel-country-state-city

Composer 安装命令:

composer require elsayed85/laravel-country-state-city

包简介

Laravel country, state and city collection.

README 文档

README

Total Downloads License

World's Country, State and City Provider for Laravel.

Installation

Run a command for Laravel 8,

composer require jaynilsavani/laravel-country-state-city:1.0.0

Run a command for Laravel 7,

composer require jaynilsavani/laravel-country-state-city:1.1.0

To publish configurations,

php artisan world:publish

Usage

To get all the data from Country:

use App\Models\Country;

// To get all the countries
$countries = Country::all();


// To get all the states from country
$states = Country::where('name','india')->first()->states; 
$stateNames = Country::where('name','india')->first()->states->pluck('name');


// To get all the cities from country
$cities = Country::where('name','india')->first()->cities; 
$cityNames = Country::where('name','india')->first()->cities->pluck('name');

To get all the data from State:

use App\Models\State;

// Retrieve all the states
$states = State::all();


// Retrieve country of any state
$country = State::where('name','quebec')->first()->country; 


// Retrieve all the cities of any state
$cities = State::where('name','quebec')->first()->cities; 

To get all the data from City:

use App\Models\City;

// Retrieve all the cities
$cities = City::all();


// Retrieve state of any city
$state = City::where('name','montreal')->first()->state; 


// Retrieve country of any city
$country = City::where('name','montreal')->first()->state->country; 

License

This package is licensed under the MIT License. Please see the License File for more details.

Contributing

Please see CONTRIBUTING for details.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-06-03