Skip to content

Commit

Permalink
Merge pull request #682 from ragingdave/disabled-perf-fix
Browse files Browse the repository at this point in the history
fix performance issue around global vs model log disabling
  • Loading branch information
Gummibeer authored Mar 10, 2020
2 parents 4e44214 + a68fb30 commit 4aa4e7d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/Traits/LogsActivity.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
use Illuminate\Support\Collection;
use Spatie\Activitylog\ActivityLogger;
use Spatie\Activitylog\ActivitylogServiceProvider;
use Spatie\Activitylog\ActivityLogStatus;

trait LogsActivity
{
Expand Down Expand Up @@ -128,7 +129,9 @@ public function attributesToBeIgnored(): array

protected function shouldLogEvent(string $eventName): bool
{
if (! $this->enableLoggingModelsEvents) {
$logStatus = app(ActivityLogStatus::class);

if (! $this->enableLoggingModelsEvents || $logStatus->disabled()) {
return false;
}

Expand Down

0 comments on commit 4aa4e7d

Please sign in to comment.