I want to write a code whereby if a user is created in my database the user must make payment. If the user does not make payment the user should be blocked. I have a column called blocked which is set to 0 by default, but if a user is blocked then its set to 1. On creation of account the created_at column is set to Carbon::now(), but if the user does not pay in 24 hours i want to block the user(i.e set the blocked column to = 1). Please help
Use Carbon methods to check if user was created more than 24 hours ago. Add this clause to the query:
->where('created_at', '<', Carbon::now()->subDay())
Don't forget to add use
clause to the top of the class where you run the query:
use Carbon\Carbon;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With