sonover/address

This package is abandoned and no longer maintained. No replacement package was suggested.
There is no license information available for the latest version (0.4) of this package.

Sonover Address Module

0.4 2018-10-13 14:05 UTC

This package is auto-updated.

Last update: 2021-07-16 00:33:51 UTC


README

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.

Installation

  1. composer require sonover/address
  2. If concord hasn't been installed yet, install it
  3. 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 |
+----+-----------------------+--------+---------+------------------+-----------------+

Usuage

class Contact extends Model {
    use Addressable;
}

Add an Address

$contact->addAddress([
    'address' => 'Example',
    'city' => 'Example City',
    'province' => 'St. George',
    'country' => 'GD',
    'postalcode' => 'GD-142'
], 'shipping');

Get all shipping addresses

$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

Remove Address

$contact->removeAddress($address)