what about add db row expiration with now() + 9 month (via http://carbon.nesbot.com/docs/#api-addsub)
when you present information about points, you can check if this point has expiration date bigger then now
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hi. I have a system with points. After a user submit a charge with stripe, Laravel crates in the DB a Row in a Table ( named 'orders') which contains: created_at, points associated with that product, product_name, user_id.
After this all i have to do to display the user points is to sum() the orders for that particular user_id. The problem is: Now i want that, the points expires after 9 month if you are not using it to purchase a product with that points.
So, i think that i have to create a cron job maybe to check if the 'created_at + 9 month' is exceeded and delete that row, but i don't know how to do that.
Maybe is there a way to create another column in the DB in the Migration, that display 'created_at + 9 month' in orders from the start. Maybe using Carbon to add Mounth to a $table->timestamp
Thanks for the attention, and excuse me for my english :)
what about add db row expiration with now() + 9 month (via http://carbon.nesbot.com/docs/#api-addsub)
when you present information about points, you can check if this point has expiration date bigger then now
Please or to participate in this conversation.