json('bookings', []) as $row) { $provenance = new Provenance($channel, 'api', Provenance::AUTHENTICATED, (string) $row['reference'], 'fake-api:'.$row['reference'], CarbonImmutable::now()); $events[] = new IncomingBooking($provenance, CarbonImmutable::parse($row['arrival']), CarbonImmutable::parse($row['departure']), $row['guests'] ?? null); if (isset($row['paid'])) { $events[] = new PaymentReported($provenance, (int) $row['paid'], CarbonImmutable::parse($row['paid_on'])); } } return $events; } }