PHP code example of wamesk / laravel-nova-address-field

1. Go to this page and download the library: Download wamesk/laravel-nova-address-field 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/ */

    

wamesk / laravel-nova-address-field example snippets


Address::make(__('customer.field.address'), 'address')

Address::make(__('customer.field.address'), 'address')
    ->withoutCompany()
    ->withoutName()
    ->withGPS()

use Wame\Address\Casts\AddressCast;

protected function casts(): array
{
    return [
        'address' => AddressCast::class,
    ];
}

protected function casts(): array
{
    return [
        'billing_address' => AddressCast::class,
        'shipping_address' => AddressCast::class,
    ];
}

$this->address->firstName; // John
$this->address->lastName; // Doe
$this->address->getName(); // John Doe
$this->address->street; // Baker street 3
$this->address->zipCode; // 08501
$this->address->city; // New York
$this->address->country; // SK
$this->address->getCountryTitle(); // Slovakia
$this->address->getCountryData();

$this->billing_address->isCompany; // true|false
$this->billing_address->companyName; // Apple Inc.
$this->billing_address->getName(); // Apple Inc.
$this->billing_address->businessId;
$this->billing_address->taxId;
$this->billing_address->vatId;
$this->billing_address->vatPayer; // true|false

$this->addess->phone;

$this->addess->latitude;
$this->addess->longitude;

$this->address->isComplete(); // true|false

$this->address->toArray();
$this->address->toJson();

Repeater::make('Address', 'address')
    ->repeatables([\Wame\Address\Fields\AddressRepeater::make()])
    ->asJson()

\Wame\Address\Utils\FakeAddress::make();
\Wame\Address\Utils\FakeCompanyAddress::make();

\Wame\Address\Utils\FakeAddress::make(['country' => 'SK']);
\Wame\Address\Utils\FakeAddress::make(withName: false);

\Wame\Address\Utils\FakeAddress::make()->toArray();
\Wame\Address\Utils\FakeAddress::make()->toJson();