The
Read more in the official Laravel docs.
transform method iterates over the collection and calls the given callback with each item in the collection. The items in the collection will be replaced by the values returned by the callback.Read more in the official Laravel docs.