get(); info(self::class, ['deposit' => $deposits->count()]); foreach ($deposits as $deposit) { $lastUpdated = Carbon::parse($deposit->updated_at); // Calculate the difference between the last updated time and the current time $timeDifference = $lastUpdated->diffInHours(Carbon::now(), false); // Check if the time difference is more than 2 hours if ($timeDifference > $maxTimeout) { $expiredIds[] = $deposit->id; } } info(self::class, ['deposit_to_expired' => count($expiredIds)]); if (count($expiredIds) > 0) { DepositHistory::whereIn('id', $expiredIds)->update(['is_valid' => DepositHistory::STATUS_EXPIRED]); } DB::commit(); info(self::class, ['done']); } }