I need to get previous 10 days activity of a user. In my case i am just getting 10 activity records instead of previous 10 days activity.
*My Code:
$activity = $this->where('user_id', '=', $userId)->paginate(10);
$activities = collect($activity->items())->groupBy(function($item) {
return \Carbon\Carbon::parse($item->created_at)->format('d-M-Y');
});
$activity->setCollection($activities);
dd($activity->toArray());
Output:
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire