I'm not sure but u can try this
$checkins = Checkin::where('created_at', Carbon::today())->get();
$checkouts = Checkout::where('created_at', Carbon::today())->get();
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hi there, I don't really know how to show the records that are only created today... Can someone help please?
So I have a list of children and each child has a checkin and checkout, what I would like is to show only the checkins and checkouts that are created today.. they both have a created_at
CheckController:
public function index()
{
$children = Child::all();
$checkins = Checkin::all(); //only show for today
$checkouts = Checkout::all(); //only show for today
return view('admin.checks.index')->withCheckins($checkins)->withCheckouts($checkouts)->withChildren($children);
}
Thanks!
@rin4ik that won't work because created_at contains the time, not just the date.
use whereDate(), which casts it to an actual date without the time.
$checkins = Checkin::whereDate('created_at', Carbon::today())->get();
// select * from `checkins` where date(`created_at`) = '2018-05-01'
Please or to participate in this conversation.