published() ->where('start_at', '>=', now()) ->orderBy('start_at') ->take(6) ->get(); $categories = Category::withCount(['events' => fn($q) => $q->published()]) ->whereHas('events', fn($q) => $q->published()) ->orderBy('name') ->get(); $totalEvents = Event::published()->count(); return view('welcome', compact('featuredEvents', 'categories', 'totalEvents')); } }