Replace per-row Flight::create() loop in RouteForgeService::commit with single multi-row Flight::insert + DB::table flight_subfleet/flight_fare bulk inserts. 100-row commit drops from ~700 queries to <=5. Drop Flight::withoutEvents wrapper: query-builder bulk insert bypasses Eloquent events natively, so no per-flight LogsActivity spam. Move ICAO uppercase/trim from App\Observers\FlightObserver to Flight model dpt_airport_id/arr_airport_id Attribute mutators; delete the observer. Single-row write paths flow through the mutators; bulk-insert path normalizes explicitly via Flight::fill + getAttributes so casts + mutators run uniformly per row. Drop synchronous SetVisibleFlights::runForBundle post-commit. Visibility settles via the queued RecomputeBundleVisibility job: BundleObserver ::created handles create-new mode, RouteForgeService dispatches explicitly in attach-existing mode (observer does not fire when no new bundle is persisted). New tests: ICAO mutator unit coverage, bulk-insert query-count budget, Queue::fake() dispatch assertions for both bundle modes. Refs OpenSpec change routeforge-commit-bulk-insert. |
||
|---|---|---|
| .. | ||
| AircraftObserver.php | ||
| AirportObserver.php | ||
| BundleObserver.php | ||
| JournalObserver.php | ||
| JournalTransactionObserver.php | ||
| SettingObserver.php | ||
| SimBriefObserver.php | ||
| SubfleetObserver.php | ||
| UserObserver.php | ||