Laravel auditing on update does not work in my laravel eloquent application in few models. except for the user model. following is the audit.php
events
'events' => [
'created',
'updated',
'deleted',
'restored',
],
'strict' => false,
'timestamps' => true,
'console' => true,
I setup my model as follows
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use OwenIt\Auditing\Contracts\Auditable;
use Illuminate\Support\Arr;
class Order extends Model implements Auditable
use \OwenIt\Auditing\Auditable;
use HasFactory;
protected $fillable = [
'order_date',
'cancel_date',
'comment',
'remark',
'customer_auto_id',
'customer',
];
public function transformAudit(array $data): array
{
Arr::set($data, 'recode_auto_id', $this->attributes['id']);
return $data;
}
public function customer()
{
return $this->hasOne(User::class, 'id', 'customer_auto_id');
}
}
creating and deleting works fine on audit except for update not auditing. please let me know the solvition.