Skip to content

Commit a28c0bf

Browse files
author
Bill Harding
committed
Move withoutGlobalScopes
1 parent 9d78ca3 commit a28c0bf

File tree

2 files changed

+25
-12
lines changed

2 files changed

+25
-12
lines changed

src/Traits/BuilderCaching.php

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,4 @@ public function truncate()
2121

2222
return parent::truncate();
2323
}
24-
25-
public function withoutGlobalScopes(array $scopes = null)
26-
{
27-
$this->scopesAreApplied = true;
28-
$this->withoutScopes = $scopes;
29-
30-
if ($scopes == null || ($scopes != null && count($scopes) == 0)) {
31-
$this->withoutAllScopes = true;
32-
}
33-
34-
return parent::withoutGlobalScopes($scopes);
35-
}
3624
}

src/Traits/Caching.php

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,31 @@ public function applyScopes()
4343
return parent::applyScopes();
4444
}
4545

46+
public function withoutGlobalScope($scope)
47+
{
48+
$this->scopesAreApplied = true;
49+
if ($this->withoutScopes == null) {
50+
$this->withoutScopes = [];
51+
}
52+
53+
array_push($this->withoutScopes[], $scope);
54+
$this->withoutAllScopes = false;
55+
56+
return parent::withoutGlobalScope($scope);
57+
}
58+
59+
public function withoutGlobalScopes(array $scopes = null)
60+
{
61+
$this->scopesAreApplied = true;
62+
$this->withoutScopes = $scopes;
63+
64+
if ($scopes == null || ($scopes != null && count($scopes) == 0)) {
65+
$this->withoutAllScopes = true;
66+
}
67+
68+
return parent::withoutGlobalScopes($scopes);
69+
}
70+
4671
protected function applyScopesToInstance()
4772
{
4873
if (! property_exists($this, "scopes")

0 commit comments

Comments
 (0)