How to loop trough all records and activate afterUpdate lifecycle?

I have the lifecycle afterUpdate on a content type, and I would like to loop through all the records and activate the lifecycle to update the data on all the records. What is the best way to do this?

I have tried to make a plugin with a button on the homepage, but I can’t get this to work, and I wonder if there is an easier way to do this.

Right now I am trying to:

  1. Use Axios to get all records.
  2. Loop through all results.
  3. Use the ID to update the records, one by one, by submitting empty data.