public function resolveData()
{
// Metadata
$this->data = ['audit_event' => $this->event, 'audit_url' => $this->url, 'audit_created_at' => $this->created_at, 'user_ip_address' => $this->ip_address, 'user_id' => $this->user_id];
if ($this->relationLoaded('user')) {
foreach ($this->user->attributesToArray() as $attribute => $value) {
$this->data['user_' . $attribute] = $value;
}
}
$this->metadata = array_keys($this->data);
// Modified Auditable attributes
foreach ($this->new as $key => $value) {
$this->data['new_' . $key] = $value;
}
foreach ($this->old as $key => $value) {
$this->data['old_' . $key] = $value;
}
$this->modified = array_diff_key(array_keys($this->data), $this->metadata);
return $this->data;
}