where('status', OtcEntrust::status_normal)->where(function ($query) { $query->where('overed_at', '<', Carbon::now()->toDateTimeString()); })->cursor(); foreach ($entrusts as $entrust) { try { $user_id = $entrust['user_id']; $params = ['entrust_id' => $entrust['id']]; (new OtcService())->cancelEntrust($user_id, $params); } catch (\Exception $exception) { info($exception); continue; } } } }