-
Notifications
You must be signed in to change notification settings - Fork 382
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Duplicate entries for every action #896
Comments
Seems like you are registering |
But how? |
It is automatic
Worst |
Thats why I didnt register it manually at first just to check if it would resolve the issue which it didnt. So the automatic discovery somehow registers it twice if thats the issue. |
It doesn't seem like a problem with this package, it seems like a problem on your implementation, |
Will do so, thanks for the input |
So, I tried some stuff,
Even after I removed the registration of the But yeah, as mentioned, some issue with the project so this can be closed. |
Alright after debugging the issue for quite some time I noticed that the Auditing event was fired twice for every send. The issue was the booted method in the model: class MyModel extends Model implements Auditable
{
use CamelCaseAttributes;
use AuditingAuditable;
protected static function booted()
{
static::addGlobalScope(new CustomScope());
parent::booted(); // this line is the issue
}
... The Fix was to remove the |
Actual Behaviour
The audits table creates two identical entries for every action.
Expected Behaviour
I'd expect a single entry for every action.
Steps to Reproduce
I'm using the default configuration for the most part except the table name. That I changed to 'auto_audits'.
Also since its Laravel 8 I did not explicitly register the
OwenIt\Auditing\AuditingServiceProvider::class
.I checked the query output using
DB::enableQueryLog
andDB::getQueryLog
which shows 1 Update query and 2 inserts into the audits table with the same values.Possible Solutions
Does the autoload somehow cause the event to be fired twice? Thats my only idea based on my findings.
The text was updated successfully, but these errors were encountered: