Closed dhcmega closed 6 months ago
Did you try updating the settings globally at the config/audit.php
file and set the 'timestamps' => false
to true
?
if audits.softdelete is true, then only update de deleted_at value, if false, then keep the current behaviour.
do you want the fields values($old
) not to be audited in SoftDelete?
@parallels999 thanks for getting back to me. I tried timestamp flag and it adds the timestamp to the audit.
Yes, if a model is softDeleted I rather only update the deleted_at
field.
Does it makes sense?
Thanks!
Does it makes sense?
Not much
Did you try transformAudit
?
use Illuminate\Database\Eloquent\SoftDeletes;
///
public function transformAudit(array $data): array
{
if ($this->auditEvent === 'deleted' && in_array(SoftDeletes::class, class_uses(get_class($this)))) {
$data['old_values'] = [];
$data['new_values'] = [];
}
return $data;
}
hi @parallels999 would I need to add that method to all models that use audit? Can I modify it for all models in one place? thank you
I use an abstract model, and all my models inherit from that
Hi I know that this has been discussed before: https://github.com/owen-it/laravel-auditing/issues/256
But, do you think it might be possible to have a "config" option for setting the behaviour of the delete? if
audits.softdelete
istrue
, then only update dedeleted_at
value, iffalse
, then keep the current behaviour.Thanks!