Hi,
I have a members table with 4 columns: First Name, Second Name, Activation_date and Status(default=0).
I want to change the value of Status from 0 to 1 when the date in Activation_date column arrives.
what is the best pattern to do that
Then scheduling is your way forward. Something like this in the App\Console\Kernel file:
protected function schedule(Schedule $schedule)
{
$schedule->call(function () {
// There is a much better way to do this, but my brain doesn't want to cooperate today
foreach (App\User::where('status', 0)->where('activation_date', { today })->get() as $user) {
$user->update(['status' => 1]);
}
})->daily();
}