diff --git a/src/Auditable.php b/src/Auditable.php index 053fac03..e35c2cab 100644 --- a/src/Auditable.php +++ b/src/Auditable.php @@ -650,7 +650,7 @@ public function transitionTo(Contracts\Audit $audit, bool $old = false): Contrac * @return void * @throws AuditingException */ - public function auditAttach(string $relationName, $id, array $attributes = [], $touch = true, $columns = ['name']) + public function auditAttach(string $relationName, $id, array $attributes = [], $touch = true, $columns = ['*']) { if (!method_exists($this, $relationName) || !method_exists($this->{$relationName}(), 'attach')) { throw new AuditingException('Relationship ' . $relationName . ' was not found or does not support method attach'); @@ -658,11 +658,11 @@ public function auditAttach(string $relationName, $id, array $attributes = [], $ $this->auditEvent = 'attach'; $this->isCustomEvent = true; $this->auditCustomOld = [ - $relationName => $this->{$relationName}()->get()->toArray() + $relationName => $this->{$relationName}()->get($columns)->toArray() ]; $this->{$relationName}()->attach($id, $attributes, $touch); $this->auditCustomNew = [ - $relationName => $this->{$relationName}()->get()->toArray() + $relationName => $this->{$relationName}()->get($columns)->toArray() ]; Event::dispatch(AuditCustom::class, [$this]); $this->isCustomEvent = false;