Addresses store shipping and billing information for customers.Documentation Index
Fetch the complete documentation index at: https://docs.lunarphp.com/llms.txt
Use this file to discover all available pages before exploring further.
Overview
Addresses belong to Customers and are used to store shipping and billing information. A customer can have multiple addresses, with the ability to mark defaults for both shipping and billing. Addresses are linked to a Country and have an optionalstate string field for storing state or province information.
Addresses
| Field | Type | Description |
|---|---|---|
id | primary key | |
customer_id | foreignId nullable | The related customer |
country_id | foreignId nullable | The related country |
title | string nullable | Salutation e.g. Mr, Mrs, Dr |
first_name | string | |
last_name | string | |
company_name | string nullable | |
tax_identifier | string nullable | |
line_one | string | Primary address line |
line_two | string nullable | |
line_three | string nullable | |
city | string | |
state | string nullable | |
postcode | string nullable | |
delivery_instructions | string nullable | Special delivery notes |
contact_email | string nullable | |
contact_phone | string nullable | |
meta | json nullable | |
shipping_default | boolean | Whether this is the default shipping address |
billing_default | boolean | Whether this is the default billing address |
created_at | timestamp | |
updated_at | timestamp |
Creating an address
The recommended way to create an address is through the customer relationship.Retrieving addresses
Default addresses
Each customer can have one default shipping address and one default billing address. These are controlled by theshipping_default and billing_default boolean fields.
Relationships
| Relationship | Type | Related Model | Description |
|---|---|---|---|
customer | BelongsTo | Lunar\Models\Customer | The customer who owns this address |
country | BelongsTo | Lunar\Models\Country | The country this address is in |