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

nasirkhannstu's avatar

Laravel date Compare

Laravel 5.4: I want to check if a date is passed 4 month

I mean i want to check if a blood donar is available for donating blood.

0 likes
1 reply
stanb's avatar

Hi,

Eloquent uses Carbon objects, please read the answer from this post. Here you can read that Carbon objects have a bunch of comparison functions.

Than what you probably want is to compare the date from when someone last time he donor-ed blood with the current date minus four months.

So you have a $dateLastTime and a $currentDateMinusFourMonths You can compare these two $dateLastTime->lte($currentDateMinusFourMonths);

I hope this will help you.

Please or to participate in this conversation.