A
A
Andre972021-07-14 19:37:45
Laravel
Andre97, 2021-07-14 19:37:45

If you sort through the models in foreach and make changes to them, can you somehow replace the original ones with these changed models?

Hello. There is a collection of models. In forich for each model I delete some fields, I add others based on them. The result is a slightly different model. Can you then somehow replace the original ones with this model, so that the output already has a collection of these models that are obtained inside the forich? Or how can this be done differently?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
J
jazzus, 2021-07-14
@Andre97

https://laravel.com/docs/8.x/collections#method-tr...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question