问题描述
我目前正在尝试使用Laravel Auditing v4.1,是的,我知道支持已经结束,由于遗留问题,我不能使用较新的版本。
问题在于,有两个应用程序将引用同一审计表。旧应用使用的是较旧的Laravel Auditing版本,其中列名与版本4.1不同。因此,我想做的是将引用旧列名称的审核记录的保存进行映射。
无论如何,到目前为止我尝试过的事情:
-
使用自定义模型。将
implementation
下的config/audit.PHP
值更改为我自己的模型App\Models\CustomAudit
namespace App\Models; use Illuminate\Database\Eloquent\Model; use OwenIt\Auditing\Audit as AuditTrait; use OwenIt\Auditing\Contracts\Audit as AuditContract; class CustomAudit extends Model implements AuditContract { use AuditTrait; /** * {@inheritdoc} */ protected $guarded = []; /** * {@inheritdoc} */ protected $casts = [ 'old_value' => 'json','new_value' => 'json',]; /** * The attributes that should be mutated to dates. * * @var array */ protected $dates = [ 'created_at','updated_at' ]; /** * The attributes that are mass assignable. * * @var array */ protected $fillable = [ 'id','user_id','owner_type','owner_id','old_value','new_value','type','route','ip',]; }
请注意,在此模型中,我使用的是旧列名,但是在提交期间,它说UnkNown column old_values
是因为它试图使用新列名。
我尝试过在线查找相关问题,但我唯一发现的是添加了其他列。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)