public function getDataValue($key)
{
if (!array_key_exists($key, $this->data)) {
return;
}
$value = $this->data[$key];
// Apply a mutator or a cast the Auditable model may have defined
if (starts_with($key, ['new_', 'old_'])) {
$originalKey = substr($key, 4);
if ($this->auditable->hasGetMutator($originalKey)) {
return $this->auditable->mutateAttribute($originalKey, $value);
}
if ($this->auditable->hasCast($originalKey)) {
return $this->auditable->castAttribute($originalKey, $value);
}
}
return $value;
}