NewWe open-sourced 50+ Laravel packages
Custom AI apps, agents and automation — Roundly ConsultingRoundly
All packages

RoundlyConsulting\Addresses\Http\Resources\AddressResource is a JsonResource with an explicit, stable shape:

use App\Models\Customer;
use Illuminate\Support\Facades\Route;
use RoundlyConsulting\Addresses\Address;
use RoundlyConsulting\Addresses\Http\Resources\AddressResource;

Route::get('/customers/{customer}/addresses', function (Customer $customer) {
    return AddressResource::collection($customer->addresses);
});

Route::get('/addresses/{address}', function (Address $address) {
    return AddressResource::make($address);
});
KeyValue
idThe address id.
typeThe type’s string value, e.g. billing.
name, city, street, postal_codeThe stored lines.
country_isoThe stored ISO code.
country_nameThe resolved name, or null without a CountryResolver.
is_primaryBoolean primary flag.
formattedThe one-line label from formatted().
metaThe meta collection, or null.
created_at, updated_atTimestamps.

country_name reflects the bound CountryResolver (null without one) and formatted is the label from formatted(). The resource is final — for a different shape, write your own JsonResource over the Address model.

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

By donating, you agree to our donation terms.

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.