protected function auditAttributes($action)
{
// Get the new and old attributes
$newAttributes = $this->cleanAttributes($this->owner->getAttributes());
$oldAttributes = $this->cleanAttributes($this->getOldAttributes());
// If no difference then get out of here
if (count(array_diff_assoc($newAttributes, $oldAttributes)) <= 0) {
return;
}
// Get the trail data
$entry_id = $this->getAuditEntryId();
$user_id = $this->getUserId();
$model = $this->owner->className();
$model_id = $this->getNormalizedPk();
$created = date($this->dateFormat);
$this->saveAuditTrail($action, $newAttributes, $oldAttributes, $entry_id, $user_id, $model, $model_id, $created);
}