Why not just save the very first date and always use that as base for calculation?
You can still keep the other column to keep track of your last credit date
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hi,
I am assigning 1000 credits to user on the day user signup (Example : 31st Jan 2020)
Now how do I restore those credits again on the renewal every month. Feb will have different date 28th or 29th Feb 2020 March credits will be restored again on 31st March 2020 April credits again on 30th April and so on.
I have created last_credit_date and it works fine for 1st month using Carbon function addMonthsNoOverflow() and updating last_credit_date to same date (29th Feb 2020)
Issue happens when I use addMonthsNoOverflow() again next month as this will change date to 29th march instead of 31st March as expected.
Please advise.
Please or to participate in this conversation.