you’re basically fighting 2 separate things here:
how do i save multiple models at once? (backend)
how do i not end up with a monster react component? (frontend)
1) backend – multiple models “in one go”
inertia vs livewire doesn’t matter here. once the request hits laravel it’s just:
“i got some nested data, i need to create/update a few models safely”.
the usual pattern:
send one payload that contains everything (invoice + client + provider + items)
validate it with nested rules (or a form request)
in the controller, wrap the whole thing in a DB::transaction()
so either all models are saved, or nothing is saved if something blows up
create/update: client, provider, invoice, then invoice items
so from laravel’s point of view it’s still just one form submit, just writing to 3–4 tables instead of 1. nothing inertia-specific about it.
2) frontend – avoid the god-component
this is where inertia + react shines if you structure it right.
core idea:
keep one single form state (invoice + client + provider + items) in your page or main form component
break the UI into small “dumb” sections:
<ClientSection />
<ProviderSection />
<InvoiceMetaSection />
<ItemsSection />
those sections don’t own state, they just receive value + onChange props
the “page” (or main form) is the only one that knows the full shape of the data and is the only place that submits
practically: you still have one form, one submit, one inertia post(), but visually and in code it feels like 3–4 smaller, focused components instead of one giant soup.
mental model that keeps things simple
treat the invoice + client + provider as one logical resource in the UI
(one screen, one save button, one request)
treat them as separate models only in the database layer
front: composition + one global state
back: validation + transaction
doesn’t matter if you’re saving 1 model or 5 — same flow, just slightly more fields.