Released in Laravel 8.57: a shorter way to write whereHas() with a simple condition inside.
// BeforeUser::whereHas('posts', function ($query) { $query->where('published_at', '>', now());})->get(); // AfterUser::whereRelation('posts', 'published_at', '>', now())->get();