PHP code example of sadegh19b / laravel-iran-cities
1. Go to this page and download the library: Download sadegh19b/laravel-iran-cities library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
sadegh19b / laravel-iran-cities example snippets
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;
bash
php artisan vendor:publish --tag=iran-cities-migrations
bash
php artisan migrate
bash
php artisan db:seed --class="Sadegh19b\LaravelIranCities\Seeders\IranCitiesSeeder"