in db i have column visit_clear
i want it 0 after one day so i used this code in kernal.php
protected function schedule(Schedule $schedule)
{
$schedule->command('cron:update-user-not-new')->daily();
}
and in command/UpdateUserNotNew.php
public function handle()
{
$dayAgo = 1; // Days ago
$dayToCheck = \Carbon\Carbon::now()->subDays($dayAgo)->format('Y-m-d');
Customer::whereDate('visit_date', '<=', $dayToCheck)
->update([
'visit_clear' => 0
]);
}
i am sheduling commnd like this as u can see cron:update-user-not-new
should i use crone:UpdateUserNotNew
?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire