Skip to content

Commit 49001f7

Browse files
authored
Fix php 8.3 deprecation Accessing static trait property(#940)
1 parent 5dd4036 commit 49001f7

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

src/Audit.php

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,6 @@ trait Audit
3434
*/
3535
protected $modified = [];
3636

37-
/**
38-
* Is globally auditing disabled?
39-
*
40-
* @var bool
41-
*/
42-
public static $auditingDisabled = false;
43-
4437
/**
4538
* {@inheritdoc}
4639
*/

src/Auditable.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ protected function getRestoredEventAttributes(): array
259259
*/
260260
public function readyForAuditing(): bool
261261
{
262-
if (static::$auditingDisabled || Audit::$auditingDisabled) {
262+
if (static::$auditingDisabled || Models\Audit::$auditingGloballyDisabled) {
263263
return false;
264264
}
265265

@@ -526,7 +526,7 @@ public function getAuditEvents(): array
526526
*/
527527
public static function isAuditingDisabled(): bool
528528
{
529-
return static::$auditingDisabled || Audit::$auditingDisabled;
529+
return static::$auditingDisabled || Models\Audit::$auditingGloballyDisabled;
530530
}
531531

532532
/**
@@ -562,12 +562,12 @@ public static function withoutAuditing(callable $callback, bool $globally = fals
562562
$auditingDisabled = static::$auditingDisabled;
563563

564564
static::disableAuditing();
565-
Audit::$auditingDisabled = $globally;
565+
Models\Audit::$auditingGloballyDisabled = $globally;
566566

567567
try {
568568
return $callback();
569569
} finally {
570-
Audit::$auditingDisabled = false;
570+
Models\Audit::$auditingGloballyDisabled = false;
571571
static::$auditingDisabled = $auditingDisabled;
572572
}
573573
}

src/Models/Audit.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,13 @@ class Audit extends Model implements \OwenIt\Auditing\Contracts\Audit
2121
*/
2222
protected $guarded = [];
2323

24+
/**
25+
* Is globally auditing disabled?
26+
*
27+
* @var bool
28+
*/
29+
public static $auditingGloballyDisabled = false;
30+
2431
/**
2532
* {@inheritdoc}
2633
*/

0 commit comments

Comments
 (0)