@@ -19,13 +19,13 @@ |
||
19 | 19 | * @return $this |
20 | 20 | */ |
21 | 21 | public function withGlobalScopes(array $scopes) |
22 | - { |
|
23 | - foreach ($scopes as $identifier => $scope) { |
|
24 | - $this->withGlobalScope($identifier, $scope); |
|
25 | - } |
|
22 | + { |
|
23 | + foreach ($scopes as $identifier => $scope) { |
|
24 | + $this->withGlobalScope($identifier, $scope); |
|
25 | + } |
|
26 | 26 | |
27 | 27 | return $this; |
28 | - } |
|
28 | + } |
|
29 | 29 | |
30 | 30 | /** |
31 | 31 | * Get the hydrated models without eager loading. |
@@ -4,83 +4,83 @@ |
||
4 | 4 | |
5 | 5 | trait TracksIntermediateScopes |
6 | 6 | { |
7 | - /** |
|
8 | - * Applied intermediate Scopes. |
|
9 | - * |
|
10 | - * @var array |
|
11 | - */ |
|
12 | - protected $intermediateScopes = []; |
|
7 | + /** |
|
8 | + * Applied intermediate Scopes. |
|
9 | + * |
|
10 | + * @var array |
|
11 | + */ |
|
12 | + protected $intermediateScopes = []; |
|
13 | 13 | |
14 | - /** |
|
15 | - * Removed intermediate Scopes. |
|
16 | - * |
|
17 | - * @var array |
|
18 | - */ |
|
19 | - protected $removedIntermediateScopes = []; |
|
14 | + /** |
|
15 | + * Removed intermediate Scopes. |
|
16 | + * |
|
17 | + * @var array |
|
18 | + */ |
|
19 | + protected $removedIntermediateScopes = []; |
|
20 | 20 | |
21 | - /** |
|
22 | - * Register a new intermediate scope. |
|
23 | - * |
|
24 | - * @param string $identifier |
|
25 | - * @param \Illuminate\Database\Eloquent\Scope|\Closure $scope |
|
26 | - * @return $this |
|
27 | - */ |
|
28 | - public function withIntermediateScope($identifier, $scope) |
|
29 | - { |
|
30 | - $this->intermediateScopes[$identifier] = $scope; |
|
21 | + /** |
|
22 | + * Register a new intermediate scope. |
|
23 | + * |
|
24 | + * @param string $identifier |
|
25 | + * @param \Illuminate\Database\Eloquent\Scope|\Closure $scope |
|
26 | + * @return $this |
|
27 | + */ |
|
28 | + public function withIntermediateScope($identifier, $scope) |
|
29 | + { |
|
30 | + $this->intermediateScopes[$identifier] = $scope; |
|
31 | 31 | |
32 | - if (method_exists($scope, 'extend')) { |
|
33 | - $scope->extend($this); |
|
34 | - } |
|
32 | + if (method_exists($scope, 'extend')) { |
|
33 | + $scope->extend($this); |
|
34 | + } |
|
35 | 35 | |
36 | - return $this; |
|
37 | - } |
|
36 | + return $this; |
|
37 | + } |
|
38 | 38 | |
39 | - /** |
|
40 | - * Remove a registered intermediate scope. |
|
41 | - * |
|
42 | - * @param \Illuminate\Database\Eloquent\Scope|string $scope |
|
43 | - * @return $this |
|
44 | - */ |
|
45 | - public function withoutIntermediateScope($scope) |
|
46 | - { |
|
47 | - if (!is_string($scope)) { |
|
48 | - $scope = get_class($scope); |
|
49 | - } |
|
39 | + /** |
|
40 | + * Remove a registered intermediate scope. |
|
41 | + * |
|
42 | + * @param \Illuminate\Database\Eloquent\Scope|string $scope |
|
43 | + * @return $this |
|
44 | + */ |
|
45 | + public function withoutIntermediateScope($scope) |
|
46 | + { |
|
47 | + if (!is_string($scope)) { |
|
48 | + $scope = get_class($scope); |
|
49 | + } |
|
50 | 50 | |
51 | - unset($this->intermediateScopes[$scope]); |
|
51 | + unset($this->intermediateScopes[$scope]); |
|
52 | 52 | |
53 | - $this->removedIntermediateScopes[] = $scope; |
|
53 | + $this->removedIntermediateScopes[] = $scope; |
|
54 | 54 | |
55 | - return $this; |
|
56 | - } |
|
55 | + return $this; |
|
56 | + } |
|
57 | 57 | |
58 | - /** |
|
59 | - * Remove all or passed registered intermediate Scopes. |
|
60 | - * |
|
61 | - * @param array|null $scopes |
|
62 | - * @return $this |
|
63 | - */ |
|
64 | - public function withoutIntermediateScopes(array $scopes = null) |
|
65 | - { |
|
66 | - if (!is_array($scopes)) { |
|
67 | - $scopes = array_keys($this->intermediateScopes); |
|
68 | - } |
|
58 | + /** |
|
59 | + * Remove all or passed registered intermediate Scopes. |
|
60 | + * |
|
61 | + * @param array|null $scopes |
|
62 | + * @return $this |
|
63 | + */ |
|
64 | + public function withoutIntermediateScopes(array $scopes = null) |
|
65 | + { |
|
66 | + if (!is_array($scopes)) { |
|
67 | + $scopes = array_keys($this->intermediateScopes); |
|
68 | + } |
|
69 | 69 | |
70 | - foreach ($scopes as $scope) { |
|
71 | - $this->withoutIntermediateScope($scope); |
|
72 | - } |
|
70 | + foreach ($scopes as $scope) { |
|
71 | + $this->withoutIntermediateScope($scope); |
|
72 | + } |
|
73 | 73 | |
74 | - return $this; |
|
75 | - } |
|
74 | + return $this; |
|
75 | + } |
|
76 | 76 | |
77 | - /** |
|
78 | - * Get an array of intermediate Scopes that were removed from the query. |
|
79 | - * |
|
80 | - * @return array |
|
81 | - */ |
|
82 | - public function removedIntermediateScopes() |
|
83 | - { |
|
84 | - return $this->removedIntermediateScopes; |
|
85 | - } |
|
77 | + /** |
|
78 | + * Get an array of intermediate Scopes that were removed from the query. |
|
79 | + * |
|
80 | + * @return array |
|
81 | + */ |
|
82 | + public function removedIntermediateScopes() |
|
83 | + { |
|
84 | + return $this->removedIntermediateScopes; |
|
85 | + } |
|
86 | 86 | } |