sadegh19b / laravel-iran-cities
A Laravel package for Iran provinces and cities seeder and models
Installs: 47
Dependents: 0
Suggesters: 0
Security: 0
Stars: 3
Watchers: 0
Forks: 0
Open Issues: 0
pkg:composer/sadegh19b/laravel-iran-cities
Requires
- php: ^8.0
- illuminate/support: ^8.0|^9.0|^10.0|^11.0|^12.0
README
A Laravel package for Iran provinces, counties and cities seeder and models.
This package uses this repo for list of cities (Thanks to @sajaddp).
Supports Laravel 8 to 12.
Installation
You can install the package via composer:
composer require sadegh19b/laravel-iran-cities
Quick Start
- Publish migrations (optional):
php artisan vendor:publish --tag=iran-cities-migrations
- Run migrations:
php artisan migrate
- Run the seeder:
php artisan db:seed --class="Sadegh19b\LaravelIranCities\Seeders\IranCitiesSeeder"
- Use the models:
use Sadegh19b\LaravelIranCities\Models\Province; use Sadegh19b\LaravelIranCities\Models\County; use Sadegh19b\LaravelIranCities\Models\City; // Get all provinces $provinces = Province::all(); // Get counties of a province $province = Province::find(1); $counties = $province->counties; // Get cities of a province $province = Province::find(1); $cities = $province->cities; // Get cities of a county $county = County::find(1); $cities = $county->cities;
License
The MIT License (MIT). Please see License File for more information.