sonover / address
Sonover Address Module
Installs: 163
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 4
Forks: 0
Open Issues: 0
pkg:composer/sonover/address
Requires
- php: >=7.0.0
- konekt/concord: ^1.2
Requires (Dev)
- mockery/mockery: ^1.1
- orchestra/testbench: ^3.7
- phpunit/phpunit: ^7.3
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
composer require sonover/address- If concord hasn't been installed yet, install it
- Edit
config/concord.phpand 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)