PHP code example of shimadotdev / iran-regions

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

    

shimadotdev / iran-regions example snippets


use Shimadotdev\IranRegions\Iran;;

// Get a province by its slug
$province = Iran::province()->where('slug', '=', 'tehran')->first();

// Get all provinces with their slugs and calling codes
$provinces = Iran::province()->get(['slug', 'calling_code']);

//Update a city
$provinces = Iran::city()->where('slug', '=', 'qom')->update(['is_active'=> 0]);

//Relations
Iran::province()->with('cities')->get();

Iran::province()->find(3)->cities;

Iran::City()->with('province')->get();

Iran::City()->where('slug', 'naeen')->first()?->province->slug;


trans('iranRegions::slug.' . $province->slug);
bash
php artisan iran-regions:install