Replies: 1 comment
-
This works but it's very dirty ->withCount(['posts => fn(Builder $posts) => $posts->published()->activityTimeframe($request->users_filter['timeframe'] ?? null)]) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have a table of Users that shows how many "active" Posts they have. I'd like to filter the
posts_count
based on a filter of how many days back to look. (1 day, 7 days, 30 days)So for the Filter, if you'd filter
timeframe=7
I want it to only count Posts for the past 7 days that have comments on them.Right now the code I have seems to actually hide the Users who do not have Posts with activity, instead of showing their count as 0.
Beta Was this translation helpful? Give feedback.
All reactions