@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | { |
10 | 10 | public function avg($column) |
11 | 11 | { |
12 | - if (! $this->isCachable()) { |
|
12 | + if (!$this->isCachable()) { |
|
13 | 13 | return parent::avg($column); |
14 | 14 | } |
15 | 15 | |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | |
21 | 21 | public function count($columns = "*") |
22 | 22 | { |
23 | - if (! $this->isCachable()) { |
|
23 | + if (!$this->isCachable()) { |
|
24 | 24 | return parent::count($columns); |
25 | 25 | } |
26 | 26 | |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | */ |
51 | 51 | public function find($id, $columns = ["*"]) |
52 | 52 | { |
53 | - if (! $this->isCachable()) { |
|
53 | + if (!$this->isCachable()) { |
|
54 | 54 | return parent::find($id, $columns); |
55 | 55 | } |
56 | 56 | |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | |
67 | 67 | public function first($columns = ["*"]) |
68 | 68 | { |
69 | - if (! $this->isCachable()) { |
|
69 | + if (!$this->isCachable()) { |
|
70 | 70 | return parent::first($columns); |
71 | 71 | } |
72 | 72 | |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | |
86 | 86 | public function get($columns = ["*"]) |
87 | 87 | { |
88 | - if (! $this->isCachable()) { |
|
88 | + if (!$this->isCachable()) { |
|
89 | 89 | return parent::get($columns); |
90 | 90 | } |
91 | 91 | |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | |
119 | 119 | public function max($column) |
120 | 120 | { |
121 | - if (! $this->isCachable()) { |
|
121 | + if (!$this->isCachable()) { |
|
122 | 122 | return parent::max($column); |
123 | 123 | } |
124 | 124 | |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | |
130 | 130 | public function min($column) |
131 | 131 | { |
132 | - if (! $this->isCachable()) { |
|
132 | + if (!$this->isCachable()) { |
|
133 | 133 | return parent::min($column); |
134 | 134 | } |
135 | 135 | |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | $pageName = "page", |
145 | 145 | $page = null |
146 | 146 | ) { |
147 | - if (! $this->isCachable()) { |
|
147 | + if (!$this->isCachable()) { |
|
148 | 148 | return parent::paginate($perPage, $columns, $pageName, $page); |
149 | 149 | } |
150 | 150 | |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | $result = ""; |
168 | 168 | |
169 | 169 | foreach ($items as $key => $value) { |
170 | - $result .= $glue . $key . $glue . $value; |
|
170 | + $result .= $glue.$key.$glue.$value; |
|
171 | 171 | } |
172 | 172 | |
173 | 173 | return $result; |
@@ -175,11 +175,11 @@ discard block |
||
175 | 175 | |
176 | 176 | public function pluck($column, $key = null) |
177 | 177 | { |
178 | - if (! $this->isCachable()) { |
|
178 | + if (!$this->isCachable()) { |
|
179 | 179 | return parent::pluck($column, $key); |
180 | 180 | } |
181 | 181 | |
182 | - $keyDifferentiator = "-pluck_{$column}" . ($key ? "_{$key}" : ""); |
|
182 | + $keyDifferentiator = "-pluck_{$column}".($key ? "_{$key}" : ""); |
|
183 | 183 | $cacheKey = $this->makeCacheKey([$column], null, $keyDifferentiator); |
184 | 184 | |
185 | 185 | return $this->cachedValue(func_get_args(), $cacheKey); |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | |
188 | 188 | public function sum($column) |
189 | 189 | { |
190 | - if (! $this->isCachable()) { |
|
190 | + if (!$this->isCachable()) { |
|
191 | 191 | return parent::sum($column); |
192 | 192 | } |
193 | 193 | |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | |
206 | 206 | public function value($column) |
207 | 207 | { |
208 | - if (! $this->isCachable()) { |
|
208 | + if (!$this->isCachable()) { |
|
209 | 209 | return parent::value($column); |
210 | 210 | } |
211 | 211 | |
@@ -273,7 +273,7 @@ discard block |
||
273 | 273 | $this->checkCooldownAndRemoveIfExpired($this->model); |
274 | 274 | } |
275 | 275 | |
276 | - $cache_callback = function () use ($arguments, $cacheKey, $method) { |
|
276 | + $cache_callback = function() use ($arguments, $cacheKey, $method) { |
|
277 | 277 | return [ |
278 | 278 | "key" => $cacheKey, |
279 | 279 | "value" => parent::{$method}(...$arguments), |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | $tags = $instance->makeCacheTags(); |
59 | 59 | $key = $instance->makeCacheKey(); |
60 | 60 | |
61 | - $cache_callback = function () use ($columns) { |
|
61 | + $cache_callback = function() use ($columns) { |
|
62 | 62 | return parent::all($columns); |
63 | 63 | }; |
64 | 64 | |
@@ -77,15 +77,15 @@ discard block |
||
77 | 77 | |
78 | 78 | public static function bootCachable() |
79 | 79 | { |
80 | - static::created(function ($instance) { |
|
80 | + static::created(function($instance) { |
|
81 | 81 | $instance->checkCooldownAndFlushAfterPersisting($instance); |
82 | 82 | }); |
83 | 83 | |
84 | - static::deleted(function ($instance) { |
|
84 | + static::deleted(function($instance) { |
|
85 | 85 | $instance->checkCooldownAndFlushAfterPersisting($instance); |
86 | 86 | }); |
87 | 87 | |
88 | - static::saved(function ($instance) { |
|
88 | + static::saved(function($instance) { |
|
89 | 89 | $instance->checkCooldownAndFlushAfterPersisting($instance); |
90 | 90 | }); |
91 | 91 | |
@@ -94,15 +94,15 @@ discard block |
||
94 | 94 | // $instance->checkCooldownAndFlushAfterPersisting($instance); |
95 | 95 | // }); |
96 | 96 | |
97 | - static::pivotAttached(function ($instance, $secondInstance, $relationship) { |
|
97 | + static::pivotAttached(function($instance, $secondInstance, $relationship) { |
|
98 | 98 | $instance->checkCooldownAndFlushAfterPersisting($instance, $relationship); |
99 | 99 | }); |
100 | 100 | |
101 | - static::pivotDetached(function ($instance, $secondInstance, $relationship) { |
|
101 | + static::pivotDetached(function($instance, $secondInstance, $relationship) { |
|
102 | 102 | $instance->checkCooldownAndFlushAfterPersisting($instance, $relationship); |
103 | 103 | }); |
104 | 104 | |
105 | - static::pivotUpdated(function ($instance, $secondInstance, $relationship) { |
|
105 | + static::pivotUpdated(function($instance, $secondInstance, $relationship) { |
|
106 | 106 | $instance->checkCooldownAndFlushAfterPersisting($instance, $relationship); |
107 | 107 | }); |
108 | 108 | } |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | |
119 | 119 | public function newEloquentBuilder($query) |
120 | 120 | { |
121 | - if (! $this->isCachable()) { |
|
121 | + if (!$this->isCachable()) { |
|
122 | 122 | $this->isCachable = false; |
123 | 123 | |
124 | 124 | return new EloquentBuilder($query); |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | EloquentBuilder $query, |
178 | 178 | int $seconds = null |
179 | 179 | ) : EloquentBuilder { |
180 | - if (! $seconds) { |
|
180 | + if (!$seconds) { |
|
181 | 181 | $seconds = $this->cacheCooldownSeconds; |
182 | 182 | } |
183 | 183 | |
@@ -186,13 +186,13 @@ discard block |
||
186 | 186 | $cacheKey = "{$cachePrefix}:{$modelClassName}-cooldown:seconds"; |
187 | 187 | |
188 | 188 | $this->cache() |
189 | - ->rememberForever($cacheKey, function () use ($seconds) { |
|
189 | + ->rememberForever($cacheKey, function() use ($seconds) { |
|
190 | 190 | return $seconds; |
191 | 191 | }); |
192 | 192 | |
193 | 193 | $cacheKey = "{$cachePrefix}:{$modelClassName}-cooldown:invalidated-at"; |
194 | 194 | $this->cache() |
195 | - ->rememberForever($cacheKey, function () { |
|
195 | + ->rememberForever($cacheKey, function() { |
|
196 | 196 | return (new Carbon)->now(); |
197 | 197 | }); |
198 | 198 |