Skip to main content

Address

This module adds the following fields:

  • Addresses (multiple of Place)
  • Phone numbers (multiple of Phone)
  • Email addresses

Each address, email and phone number can have a custom label. For addresses, you can click on an active tab to edit its label.

Installation

To install this module

composer require qore/address
php artisan vendor:publish --tag=qore.address.db
php artisan vendor:publish --tag=qore.address.frontend

Usage

Make sure to migrate.

To use this module

Add the following traits to your model, this will add the required relationships for each field.

use HasAddresses;
use HasPhoneNumbers;
use HasEmailAddresses;

Fields:

PhoneNumbers::make(__('crm::crm.Phone'), 'phoneNumbers')

Addresses::make(__('crm::crm.Address'), 'addresses')

EmailAddresses::make(__('crm::crm.Email'), 'emailAddresses')

To make at least one required:

Addresses::make(__('crm::crm.Address'), 'addresses')
->rules('required')

Each address, phone number and email address can be marked as default (primary), and can be retrieved:

primaryAddress
primaryEmailAddress
primaryPhoneNumber

Different address types

In some cases you might want to have different types than Visit, Invoice and Delivery. You can provide a different TenantVariable:

return Addresses::make(__('crm::crm.Address'), 'addresses')
->withAddressType(tenant_variable('employee_address_types'))

Upgrade Guide

To upgrade this module

composer update qore/address

If you need to upgrade migrations or Vue components:

php artisan vendor:publish --tag=qore.address.db --force
php artisan vendor:publish --tag=qore.address.frontend --force

Make sure to migrate after.