php - Getting all users that created an item today in Laravel -
i want make list of users created item.
these items have row user_id
to items created today, this:
$items = item::whereday('created_at', '=', date('d'));
now want perform query gives me users have created item today. there users created 1000 items, , there users didn't @ all.
i ->unique()
there must surely better way this.
any suggestions?
assuming have items
relationship set on user
model like:
$users = user::wherehas('items', function ($query) { $query->where('created_at', '>=', \carbon\carbon::today()); })->get();
hope helps!
Comments
Post a Comment