再次比较了laravel / framework包中5.4和5.5标签之间的变化,我发现了原因
getDirty
的方法
<code>
src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php
</code>
特征。
在laravel 5.4中有:
foreach ($this->attributes as …
然后在5.5中它被改为:
foreach ($this->getAttributes() as …
如
getAttributes
方法是解密数据的方法之一,它看起来目前最明智的解决方案是覆盖
getDirty()
无论是加密特征还是使用它的应用程序模型。
修改后的方法如下所示:
public function getDirty()
{
$dirty = [];
foreach ($this->attributes as $key => $value) {
if (! $this->originalIsEquivalent($key, $value)) {
$dirty[$key] = $value;
}
}
return $dirty;
}
</code>