01Section-aware import
Real partner exports are not tables. One sheet stacks an arrival block, a departure block and a hotel-to-hotel block, each behind a banner row, each re-emitting its own differently ordered header, with Excel time serials anchored at 1899 and passenger counts written as "2 + 0". I wrote the reader to detect the densest header row, return the union of every section's columns so none are dropped silently, adopt each section's own header for the rows beneath it, and tag every row with the date printed on its banner, which is what finally stopped imported transfers landing on the import date instead of the date in the file.
02A booking is not a job
The transfers table carried a unique index on the reservation number. But a reservation number is a booking reference, and the same booking appears once per leg, so importing a multi-leg file collapsed an arrival and a departure into one row, the later leg silently overwriting the earlier while the importer still reported every row as succeeded. I caught it from the outside, by uploading a seventeen-row file and counting what came back. I now key the upsert on reservation number plus route, so legs coexist and re-imports stay idempotent.
03Tenancy as global scopes
The opening ask was a separate database per supplier. What I shipped is row-level isolation in one database, written as three Eloquent global scopes with different rules: owned resources such as drivers and coaches scope on tenant id, transfers scope on the assigned supplier because a delegated job stays the DMC's, and the partner directory narrows a supplier to its own row so dropdowns stop leaking the roster. Because they are global scopes, every existing query site inherited the rule without my rewriting it, and nine feature tests hold it in place.
04One trigger, every channel
There were two ways work reached a supplier and only one of them was visible. An explicit delegation notified; picking that supplier's driver off the scheduler notified nobody. I put a saving hook on the transfer observer that stamps the supplier whenever their coach or driver is assigned, and that same observer fires the in-app notification, the Expo push and the Reverb websocket event, so the channels cannot drift. I snapshot the broadcast payload as a plain array at dispatch time rather than serialising the model, so the queue worker never re-queries under a stale global scope.
05Written for its maintainers
I started this repo with context rather than a feature: a CLAUDE.md and thirteen domain files covering transfers, fleet, tenancy, import and export, the mobile API and the rest. Each carries a gotchas section recording the actual scars, including a soft-delete-plus-unique-constraint collision in the seeder and a pluck call that reads a dot in a column header as nested access.