Skip to content
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

auditExclude merge versus replace #969

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
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
13 changes: 13 additions & 0 deletions config/audit.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions src/Auditable.php
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,12 @@ protected function resolveAuditExclusions()
*/
public function getAuditExclude(): array
{
if (
$this->auditExcludeMerge ?? Config::get('audit.exclude_merge', false)

Choose a reason for hiding this comment

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

It seems that you decided not to follow the instructions

the false is not necessary, the default is null and the null on a if is already false

if ($this->auditExcludeMerge ?? Config::get('audit.exclude_merge')) {

Copy link
Author

Choose a reason for hiding this comment

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

Apologies, now I understand. Code updated.

Copy link

@parallels999 parallels999 Sep 19, 2024

Choose a reason for hiding this comment

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

Code updated.

the 'false' is still there 😕

) {
erikn69 marked this conversation as resolved.
Show resolved Hide resolved
return array_merge($this->auditExclude ?? [], Config::get('audit.exclude', []));
}

return $this->auditExclude ?? Config::get('audit.exclude', []);
}

Expand Down