PHP code example of ab01faz101 / iran-provinces

1. Go to this page and download the library: Download ab01faz101/iran-provinces 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/ */

    

ab01faz101 / iran-provinces example snippets


use App\Models\Province;

$provinces = Province::all();

$province = Province::find(1);

$cities = $province->cities;

use App\Models\City;

$city = City::find(1);

$province = $city->province;    
bash
php artisan vendor:publish --tag=iran-provinces-migrations
bash
php artisan vendor:publish --tag=iran-provinces-models
bash
php artisan vendor:publish --tag=iran-provinces-seeders
bash
php artisan vendor:publish --provider="Ab01faz101\IranProvinces\IranProvincesServiceProvider"
bash
php artisan migrate

php artisan db:seed --class=IranProvincesSeeder