PHP code example of dillingham / locality

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

    

dillingham / locality example snippets


$table->addAddress();



namespace App\Models;

use Dillingham\Locality\HasAddress;

class Profile extends Model
{
  use HasAddress;
}

Profile::create([
    'address_1' => '104 India St',
    'address_2' => 'Apt #3L',
    'admin_level_2' => 'Brookyln',    
    'admin_level_1' => 'NY',
    'postal_code' => '11222',
]);

'admin_level_2' => 'Brookyln'

'admin_level_2_id' => 332

$profile->admin_level_2 == 'Brooklyn'
$profile->admin_level_1 == 'NY'

$profile->formatted_address == '104 India St, #3l Brooklyn, NY 11222`

Route::localityDepenentOptions();
bash
php artisan vendor:publish --provider="Dillingham\Locality\LocalityServiceProvider" --tag="locality-config"

php artisan migrate

GET /api/locality/admin_level_2?country_id=1

GET /api/locality/postal_code?admin_level_1_id=1