Load data completed between two timestamps

While using the whereBetween() to load records between two timestamps, you can pass the fallback value using the null coalescing operator (??).

// Load tasks completed between two timestamps
Task::whereBetween('completed_at', [
$request->from ?? '2023-01-01',
$request->to ?? today()->toDateTimeString(),
]);

Tip given by @LaraShout

Recent New Courses