I have an issue with the touch()
method. Here's the flow:
- I'm temporarily decrypting the field inside the model to send to the authorized user.
- Updating
updated_at
timestamp with new log entry to indicate that field was decrypted. - Returning decrypted model with the response without saving it in DB.
The issue:
So, here's the problem: When I do $model->touch()
it is saving the whole model (as expected as Laravel's only checking if updated_at
column isDirty()
, not the whole model, and then calling $this->save()
).
Question:
Is there another method that I can use to just update the model's timestamps regardless of if other attributes have been changed?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire