Sonover Address is a Concord module that allows you to store addresses for an entity. Being a Concord module it is intended to be used by Laravel Applications.
composer require sonover/address
- If concord hasn't been installed yet, install it
- Edit
config/concord.php
and add the address module:
return [
'modules' => [
Sonover\Address\Providers\ModuleServiceProvider::class
]
];
After this, address should be listed among the concrd modules:
php artisan concord:modules -a
+----+-----------------------+--------+---------+------------------+-----------------+
| # | Name | Kind | Version | Id | Namespace |
+----+-----------------------+--------+---------+------------------+-----------------+
| 1. | Sonover Address Module | Module | 0.2.0 | sonover.address | Sonover\Address |
+----+-----------------------+--------+---------+------------------+-----------------+
class Contact extends Model {
use Addressable;
}
$contact->addAddress([
'address' => 'Example',
'city' => 'Example City',
'province' => 'St. George',
'country' => 'GD',
'postalcode' => 'GD-142'
], 'shipping');
$contact->shippingAddress
The following types are supported out of the box: billing
, business
, contract
, mailing
, pickup
, residential
and shipping
If you want to extend this list for your application refer to Extending Enums in Concord's documentation.
You can grab any address by the type $contact->{type}Address
$contact->removeAddress($address)