Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

sadegh19b/laravel-iran-cities

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

3 Commits

Repository files navigation

Iran Cities for Laravel

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 13.

Installation

You can install the package via composer:

composer require sadegh19b/laravel-iran-cities

Quick Start

  1. Publish migrations (optional):
php artisan vendor:publish --tag=iran-cities-migrations
  1. Run migrations:
php artisan migrate
  1. Run the seeder:
php artisan db:seed --class="Sadegh19b\LaravelIranCities\Seeders\IranCitiesSeeder"
  1. 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.

About

A Laravel package for Iran provinces, counties and cities seeder and models.

Resources

License

Stars

Watchers

Forks

Contributors

Languages

AltStyle によって変換されたページ (->オリジナル) /