Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

sanjayacloud's avatar

How to get next seven day data in laravel

Hi Guys,

I want to get the next seven data in laravel using carbon to send a reminder. Actually I want to do an opposite in below method.

$anchor = Carbon::today()->subDay(7);
$users = Invoices::where('created_at', '>=', $date)->get();


dd($users);

0 likes
2 replies
Snapey's avatar

You want to find invoices that are due in the next 7 days?

Why would any created_at date be in the future? Please explain further.

1 like
guybrush_threepwood's avatar
Level 33
$startDate = Carbon::today();
$endDate = Carbon::today()->addDays(7);
$invoices = Invoice::whereBetween('due_date', [$startDate, $endDate])->get();
// Replace "due_date" with your actual column name
// Check your model names, they should be singular and not plural.

dd($invoices);
1 like

Please or to participate in this conversation.