diff --git a/config/audit.php b/config/audit.php index d6cee429..84d12b81 100644 --- a/config/audit.php +++ b/config/audit.php @@ -86,6 +86,19 @@ 'exclude' => [], + /* + |-------------------------------------------------------------------------- + | Global exclusion merge + |-------------------------------------------------------------------------- + | + | If set to true, the local model auditExclude array values will be + | merged with the config exclude array values instead of replacing + | them. + | + */ + + 'exclude_merge' => false, + /* |-------------------------------------------------------------------------- | Empty Values diff --git a/src/Auditable.php b/src/Auditable.php index 3696afb2..d25ccb1a 100644 --- a/src/Auditable.php +++ b/src/Auditable.php @@ -143,6 +143,12 @@ protected function resolveAuditExclusions() */ public function getAuditExclude(): array { + if ( + $this->auditExcludeMerge ?? Config::get('audit.exclude_merge', false) + ) { + return array_merge($this->auditExclude ?? [], Config::get('audit.exclude', [])); + } + return $this->auditExclude ?? Config::get('audit.exclude', []); }