each(function (Tenant $tenant) use ($autoOffer): void { $pending = Booking::query() ->where('status', BookingStatus::Reserved) ->where('offer_version', 0) ->where('hold_expires_at', '>', now()) ->whereHas('property', fn ($query) => $query->where('offer_mode', OfferMode::Automatic)->where('pre_reservation_enabled', true)) ->with(['property', 'guest']) ->get(); $sent = 0; foreach ($pending as $booking) { try { $sent += $autoOffer->handle($booking) === [] ? 1 : 0; } catch (Throwable) { // The request stays pending for the landlord; the next run tries again. } } $this->info("{$tenant->name}: {$sent} von {$pending->count()} Angebot(e) automatisch versendet."); }); return self::SUCCESS; } }