PHP code example of nurbekjummayev / laravel-region
1. Go to this page and download the library: Download nurbekjummayev/laravel-region 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/ */
nurbekjummayev / laravel-region example snippets
use Nurbekjummayev\LaravelRegion\Models\Region;
use Nurbekjummayev\LaravelRegion\Models\District;
// Find by COATO code
Region::findByCode('1735');
Region::findByTaxCode('35');
// Active regions with districts
Region::active()->with('districts')->get();
// Find district
District::findByCode('1735204');
District::query()->inRegion('1735')->get();
// Relationships
$district = District::findByCode('1735204');
$district->region->name; // "Republic of Karakalpakstan"
$district->name; // current locale