SoftDelete behaviour config option true/false #911
-
Hi But, do you think it might be possible to have a "config" option for setting the behaviour of the delete? Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments
-
Did you try updating the settings globally at the
do you want the fields values( |
Beta Was this translation helpful? Give feedback.
-
@parallels999 thanks for getting back to me. Yes, if a model is softDeleted I rather only update the |
Beta Was this translation helpful? Give feedback.
-
Not much Did you try 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;
} |
Beta Was this translation helpful? Give feedback.
-
hi @parallels999 would I need to add that method to all models that use audit? |
Beta Was this translation helpful? Give feedback.
-
I use an abstract model, and all my models inherit from that |
Beta Was this translation helpful? Give feedback.
Not much
Did you try
transformAudit
?