---
title: "The Addresses facade — Addresses for Laravel | Roundly"
description: "Addresses::for($owner) returns an owner’s address book for any model; update, delete and countryName work on a single address."
url: https://roundly-consulting.com/open-source/docs/addresses-for-laravel/facade
language: en
---

[All packages](https://roundly-consulting.com/open-source.md)

[Addresses for Laravel](https://roundly-consulting.com/open-source/docs/addresses-for-laravel.md)

# The Addresses facade

The Addresses facade is the recommended entry point. Addresses::for($owner) returns the owner’s address book — works on any Eloquent model, no trait required — and the operations on a single address that need no owner scope are flat:

```php
use RoundlyConsulting\Addresses\DataTransferObjects\AddressData;
use RoundlyConsulting\Addresses\Enums\AddressType;
use RoundlyConsulting\Addresses\Facades\Addresses;

// One owner's address book — any Eloquent model, no trait required.
$book = Addresses::for($supplier);

$book->new()                                    // fluent PendingAddress
    ->type(AddressType::Work)
    ->in('Bratislava')->at('Somewhere 1')->postalCode('81101')->country('SK')
    ->save();
$book->add(AddressData::make(city: 'Košice', street: 'Main 2', postalCode: '04001', countryIso: 'SK'));

$book->all();                                   // Collection<Address>, oldest first
$book->primary();                               // primary across all types (or null)
$book->primary(AddressType::Billing);           // primary of a type
$book->ofType(AddressType::Office);             // collection of a type
$book->setPrimary($address);                    // promote; refuses another owner's or a deleted address

// One address — no owner scope needed.
Addresses::update($address, $data);             // full write, dispatches AddressUpdated
Addresses::delete($address);                    // soft delete, dispatches AddressDeleted
Addresses::countryName('sk');                   // resolved name, or 'SK' without a resolver
```

## Facade methods

| Method | Returns | What it does |
| --- | --- | --- |
| `Addresses::for(Model $addressable)` | AddressBook | The owner’s address book — build, add, read and promote its addresses. |
| `Addresses::update(Address $address, AddressData $data)` | Address | Full write of one address; isPrimary: true promotes it, leaving it out demotes it. Dispatches AddressUpdated, then PrimaryAddressChanged on a promotion. |
| `Addresses::delete(Address $address)` | void | Soft-deletes one address; dispatches AddressDeleted. |
| `Addresses::countryName(string $iso)` | string | The resolved country name, or the normalised ISO code without a resolver. |
| `Addresses::fake()` | AddressesFake | Swap in the recording fake (see Testing). |

## The address book

Every read and write scoped to one owner lives on its AddressBook. $model->addressBook() on a HasAddresses model returns the same object:

| AddressBook method | Returns | What it does |
| --- | --- | --- |
| `new()` | PendingAddress | Start the fluent builder bound to this owner. |
| `add(AddressData $data)` | Address | Create an address from a DTO; dispatches AddressCreated, then PrimaryAddressChanged when isPrimary promotes it. |
| `all()` | Collection<int, Address> | Every address of the owner, oldest first. |
| `primary(?AddressType $type = null)` | ?Address | The primary address of a type, or the first primary of any type. |
| `ofType(AddressType $type)` | Collection<int, Address> | Every address of a type, oldest first. |
| `setPrimary(Address $address)` | Address | Promote one of this owner’s addresses; throws AddressOwnershipException for another owner’s and TrashedAddressException for a soft-deleted one. |

The reads query the configured address model with whereMorphedTo('addressable', $model), so they honour a custom model and exclude soft-deleted rows.

## Alias

The facade is registered as the global alias Addresses by default; rename or disable it with the facade\_alias config key (see Configuration). To avoid static calls altogether, inject AddressManager or run an action — see DI and actions.

## Show your open-source love

This package is free and MIT-licensed. If it saves you time, a one-off donation or a Patreon membership keeps it maintained, tested and documented.

[More ways to support, including crypto](https://roundly-consulting.com/support-us.md)

By donating, you agree to our [donation terms](https://roundly-consulting.com/donation-terms.md).

[Support our open source work (opens in a new tab)](https://donate.stripe.com/dRmeVe8FX5PF1Qd9pXcEw00) [Join us on Patreon (opens in a new tab)](https://www.patreon.com/cw/roundly)

## Want this built into your product?

We integrate our packages into custom Laravel and AI builds. Tell us what you're working on and we'll reply within 48 hours.

[Get a quote in 48 hours](https://roundly-consulting.com/contact.md) [Browse all packages](https://roundly-consulting.com/open-source/docs/addresses-for-laravel.md)
