Skip to content

Commit

Permalink
Revert "fix: RecordCustomAudit listener (#963)"
Browse files Browse the repository at this point in the history
This reverts commit 40fbbe1.
  • Loading branch information
erikn69 authored Feb 18, 2025
1 parent 717d307 commit e3ca99b
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/Auditable.php
Original file line number Diff line number Diff line change
Expand Up @@ -819,7 +819,7 @@ private function dispatchRelationAuditEvent($relationName, $event, $old, $new)

$this->auditEvent = $event;
$this->isCustomEvent = true;
Event::dispatch(new AuditCustom($this));
Event::dispatch(AuditCustom::class, [$this]);
$this->auditCustomOld = $this->auditCustomNew = [];
$this->isCustomEvent = false;
}
Expand Down
5 changes: 2 additions & 3 deletions src/Listeners/RecordCustomAudit.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@

namespace OwenIt\Auditing\Listeners;

use OwenIt\Auditing\Events\AuditCustom;
use OwenIt\Auditing\Facades\Auditor;

class RecordCustomAudit
{
public function handle(AuditCustom $event): void
public function handle(\OwenIt\Auditing\Contracts\Auditable $model): void
{
Auditor::execute($event->model);
Auditor::execute($model);
}
}
2 changes: 1 addition & 1 deletion tests/Functional/AuditingTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -936,7 +936,7 @@ public function test_can_audit_any_custom_event(): void
$article->auditCustomNew = [
'customExample' => 'Darth Vader',
];
Event::dispatch(new AuditCustom($article));
Event::dispatch(AuditCustom::class, [$article]);

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

0 comments on commit e3ca99b

Please sign in to comment.