I have two users: one admin and another simple user. When user wants to edit data, it goes request to admin like "pending for verification"; only after verifying, data will update. This is image for status column of table:
When data is edited from user, status is 4, and when verified, it must be 5. Can you help me how can I save old data upto when new data is not verified and how to replace it after verification?
You can use this way to fix this problem. (Of course, this is my point)
Save the data in a table and add a new column with the status name in this field to check if the data has been verified.
Save the information in a different table. An interface table !!! Then, when the administrator verified that using the Identity Interface, paste these new values, then erase the new values from the interface table after inserting them
I think something like that:
User change:
$newItem = new TempModel($someRequestData);
$item->some_foreign_key_name = $request->input('id');
$item->save();
Admin verify:
$newItem = TempModel::where('some_foreign_key_name', $request->input('id'))->first();
$oldItem = Model::find($request->input('id'));
$oldItem->fill($newItem->toArray());
$oldItem->save();
$newItem->delete();
add $guarded to current model, if you are not using $fillable:
protected $guarded = ['some_foreign_key_name'];