I'm trying to set up a scheduling task that can run every five minutes, but it only works 1 time, after the first five minutes, the other five minutes dont do the function correctly.
//depresiasicounter.php
protected $signature = 'updates:depresiasicounter';
public function handle()
{
$aktivatb = Aktivatb::where('id','1')->first();
$aktivatb->nilai= $aktivatb->nilai-$aktivatb->depresiasi;
$aktivatb->total_depresiasi = $aktivatb->total_depresiasi+$aktivatb->depresiasi;
$aktivatb->save();
}
//kernel.php
protected $commands = [
Commands\DepresiasiCounter::class,
];
protected function schedule(Schedule $schedule)
{
$schedule->commands('updates:depresiasicounter')->everyFiveMinutes();
}
I expect it can be work until the value of $aktivatb->nilai to 0, but it only works 1 time