option('hours')); $limit = max(1, (int) $this->option('limit')); $cutoff = now()->subHours($hours); $events = Event::query() ->where('status', 'published') ->where('is_active', true) ->whereNotNull('date') ->where('date', '<=', $cutoff) ->whereDoesntHave('guestNotifications', function ($query) { $query->where('type', GuestNotificationType::FEEDBACK_REQUEST->value); }) ->orderBy('date') ->limit($limit) ->get(); $count = 0; foreach ($events as $event) { $title = 'Danke fürs Mitmachen – wie war dein Erlebnis?'; $body = 'Teile dein kurzes Feedback mit dem Gastgeber oder lade deine Lieblingsmomente noch einmal hoch.'; $this->notifications->createNotification( $event, GuestNotificationType::FEEDBACK_REQUEST, $title, $body, [ 'audience_scope' => GuestNotificationAudience::ALL, 'expires_at' => now()->addHours(12), ] ); $count++; } $this->info(sprintf('Feedback reminders dispatched for %d event(s).', $count)); return Command::SUCCESS; } }