Skip to content

Commit 627a7b7

Browse files
committed
Revert "fix: RecordCustomAudit listener (#963)"
This reverts commit 40fbbe1.
1 parent 7339563 commit 627a7b7

File tree

3 files changed

+4
-5
lines changed

3 files changed

+4
-5
lines changed

Diff for: src/Auditable.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -819,7 +819,7 @@ private function dispatchRelationAuditEvent($relationName, $event, $old, $new)
819819

820820
$this->auditEvent = $event;
821821
$this->isCustomEvent = true;
822-
Event::dispatch(new AuditCustom($this));
822+
Event::dispatch(AuditCustom::class, [$this]);
823823
$this->auditCustomOld = $this->auditCustomNew = [];
824824
$this->isCustomEvent = false;
825825
}

Diff for: src/Listeners/RecordCustomAudit.php

+2-3
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,12 @@
22

33
namespace OwenIt\Auditing\Listeners;
44

5-
use OwenIt\Auditing\Events\AuditCustom;
65
use OwenIt\Auditing\Facades\Auditor;
76

87
class RecordCustomAudit
98
{
10-
public function handle(AuditCustom $event): void
9+
public function handle(\OwenIt\Auditing\Contracts\Auditable $model): void
1110
{
12-
Auditor::execute($event->model);
11+
Auditor::execute($model);
1312
}
1413
}

Diff for: tests/Functional/AuditingTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1109,7 +1109,7 @@ public function can_audit_any_custom_event()
11091109
$article->auditCustomNew = [
11101110
'customExample' => 'Darth Vader',
11111111
];
1112-
Event::dispatch(new AuditCustom($article));
1112+
Event::dispatch(AuditCustom::class, [$article]);
11131113

11141114
$this->assertDatabaseHas(config('audit.drivers.database.table', 'audits'), [
11151115
'auditable_id' => $article->id,

0 commit comments

Comments
 (0)