G
G
Glory2021-03-10 20:41:25
Laravel
Glory, 2021-03-10 20:41:25

What is the easiest way to determine which fields have changed when the model is updated?

When importing a product, a large array of data is collected and then the product is either created or the existing product is upgraded, where the array of collected data is passed to the input.

I would like to log information about field changes. What is the best way to do this in Laravel?

I would like to do without overkill.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
K
Konstantin B., 2021-03-10
@Kostik_1993

If you haven’t read the dock in Google, enter Laravel Dirty, read for 3-5 minutes, understand, then do it as you need.

I
Ilya, 2021-03-10
@New_Horizons

Laravel Auditing
Here is a good one just for your task - a log of model changes.
And so, yes, as they wrote above, the isDirty method of the model

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question