Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions config/audit.php
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@
'connection' => 'sync',
'queue' => 'default',
'delay' => 0,
'listener' => OwenIt\Auditing\Listeners\ProcessDispatchAudit::class,
],

/*
Expand Down
3 changes: 2 additions & 1 deletion src/AuditingServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace OwenIt\Auditing;

use Illuminate\Support\Facades\Config;
use Illuminate\Support\Facades\Event;
use Illuminate\Support\ServiceProvider;
use OwenIt\Auditing\Console\AuditDriverCommand;
Expand All @@ -26,7 +27,7 @@ public function boot()
$this->mergeConfigFrom(__DIR__.'/../config/audit.php', 'audit');

Event::listen(AuditCustom::class, RecordCustomAudit::class);
Event::listen(DispatchAudit::class, ProcessDispatchAudit::class);
Event::listen(DispatchAudit::class, Config::string('audit.queue.listener', ProcessDispatchAudit::class));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@willpower232 hi, maybe an interface check, to prevent someone from setting up a class that is not a listener, or some non-existent class

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we are going to have settable listeners, shouldn't RecordCustomAudit listener have the same option?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@markieo1 what do you think about adding an option for the custom audit and then using class_exists and probably method_exists for handle? not sure there is an interface for event listeners

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is a good option, another could be to create a new contract that requires having a handle method and validate that interface.

}

/**
Expand Down