I am using Laravel 9 and I have users table that have active_until column (timestamp) and valid column (boolean) for each user.
when a user is activated by the admin, the user gets active_until to be after 6 months from now, and gets valid = 1 .
what I want to do is to make the valid = 0 automatically after the 6 months have passed (when now() >= active_until).
I am using this because I set different Gates (permissions) for the users that have valid = 1 than those who have valid = 0 .
I know I can always check for example for:
if ($user->active_until <= now())
whithout the need to the valid column, but what if this is the case ?
thanks