Level 104
What does the percentage change represent - change compared to what?
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
$dailySignups = User::selectRaw('DATE(created_at) as date, COUNT(*) as count')
->groupBy('date')
->where('created_at', '>', Carbon::now()->subWeek())
->get();
It prints this as a response
{
"date": "2022-11-20",
"count": 2
},
{
"date": "2022-11-19",
"count": 20
},
{
"date": "2022-11-18",
"count": 2
},
...
But I want to get the daily percentage as swell something like this dummy response below, any help will be really appreciated
...
{
"date": "2022-11-18",
"count": 20,
"percentage_change: 40
}
...
Please or to participate in this conversation.