Skip to content

Commit 1ad0799

Browse files
Merge pull request owen-it#497 from andreshg112/8.0
Added audit.enabled config.
2 parents 825f576 + 3c0ddd8 commit 1ad0799

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
.idea
22
/vendor
33
composer.lock
4+
.vscode

config/audit.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
return [
44

5+
'enabled' => env('AUDITING_ENABLED', true),
6+
57
/*
68
|--------------------------------------------------------------------------
79
| Audit Implementation

src/Auditable.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -283,8 +283,8 @@ public function toAudit(): array
283283
'event' => $this->auditEvent,
284284
'auditable_id' => $this->getKey(),
285285
'auditable_type' => $this->getMorphClass(),
286-
$morphPrefix.'_id' => $user ? $user->getAuthIdentifier() : null,
287-
$morphPrefix.'_type' => $user ? $user->getMorphClass() : null,
286+
$morphPrefix . '_id' => $user ? $user->getAuthIdentifier() : null,
287+
$morphPrefix . '_type' => $user ? $user->getMorphClass() : null,
288288
'url' => $this->resolveUrl(),
289289
'ip_address' => $this->resolveIpAddress(),
290290
'user_agent' => $this->resolveUserAgent(),
@@ -487,7 +487,7 @@ public static function isAuditingEnabled(): bool
487487
return Config::get('audit.console', false);
488488
}
489489

490-
return true;
490+
return Config::get('audit.enabled', true);
491491
}
492492

493493
/**

0 commit comments

Comments
 (0)