- Save address in one JSON database column
- Personal or business address
- Google Maps Autocomplete
laravel/nova: ^4.0
composer require wamesk/laravel-nova-address-field
Address::make(__('customer.field.address'), 'address')
Parameter | Description |
---|---|
countryList(['sk' => 'Slovakia']) |
Custom country list |
onlyCompany() |
Show only company address |
withoutCompany() |
Show only personal address |
withoutAddressSuggestions() |
Without address suggestions if set Google Maps API key |
defaultShowCompany() |
Show default company tab |
withoutName() |
Without personal user name |
Setting casts in model
use Wame\Address\Casts\AddressCast;
protected function casts(): array
{
return [
'address' => AddressCast::class,
];
}
In one model, there can be more address columns
protected function casts(): array
{
return [
'billing_address' => AddressCast::class,
'shipping_address' => AddressCast::class,
];
}
Package is also compatible with Nova repeatable field
Repeater::make('Address', 'address')
->repeatables([\Wame\Address\Fields\AddressRepeater::make()])
->asJson()
If you add the Google Maps API key to the .env, you can search for addresses
GOOGLE_MAPS_API_KEY="AIza..."