@@ -23,19 +23,19 @@ discard block |
||
23 | 23 | $class = get_called_class(); |
24 | 24 | $instance = new $class; |
25 | 25 | |
26 | - static::created(function () use ($instance) { |
|
26 | + static::created(function() use ($instance) { |
|
27 | 27 | $instance->flushCache(); |
28 | 28 | }); |
29 | 29 | |
30 | - static::deleted(function () use ($instance) { |
|
30 | + static::deleted(function() use ($instance) { |
|
31 | 31 | $instance->flushCache(); |
32 | 32 | }); |
33 | 33 | |
34 | - static::saved(function () use ($instance) { |
|
34 | + static::saved(function() use ($instance) { |
|
35 | 35 | $instance->flushCache(); |
36 | 36 | }); |
37 | 37 | |
38 | - static::updated(function () use ($instance) { |
|
38 | + static::updated(function() use ($instance) { |
|
39 | 39 | $instance->flushCache(); |
40 | 40 | }); |
41 | 41 | } |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | $key = 'genealabslaravelmodelcachingtestsfixturesauthor'; |
66 | 66 | |
67 | 67 | return $instance->cache($tags) |
68 | - ->rememberForever($key, function () use ($columns) { |
|
68 | + ->rememberForever($key, function() use ($columns) { |
|
69 | 69 | return parent::all($columns); |
70 | 70 | }); |
71 | 71 | } |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | |
43 | 43 | protected function getLimitClause() : string |
44 | 44 | { |
45 | - if (! $this->query->limit) { |
|
45 | + if (!$this->query->limit) { |
|
46 | 46 | return ''; |
47 | 47 | } |
48 | 48 | |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | |
57 | 57 | protected function getOffsetClause() : string |
58 | 58 | { |
59 | - if (! $this->query->offset) { |
|
59 | + if (!$this->query->offset) { |
|
60 | 60 | return ''; |
61 | 61 | } |
62 | 62 | |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | return ''; |
70 | 70 | } |
71 | 71 | |
72 | - return '_' . implode('_', $columns); |
|
72 | + return '_'.implode('_', $columns); |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | protected function getWhereClauses(array $wheres = []) : string |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | $wheres = collect($this->query->wheres); |
81 | 81 | } |
82 | 82 | |
83 | - return $wheres->reduce(function ($carry, $where) { |
|
83 | + return $wheres->reduce(function($carry, $where) { |
|
84 | 84 | if (in_array($where['type'], ['Exists', 'Nested'])) { |
85 | 85 | return $this->getWhereClauses($where['query']->wheres); |
86 | 86 | } |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | } |
91 | 91 | |
92 | 92 | if ($where['type'] === 'raw') { |
93 | - return "_{$where['boolean']}_" . str_slug($where['sql']); |
|
93 | + return "_{$where['boolean']}_".str_slug($where['sql']); |
|
94 | 94 | } |
95 | 95 | |
96 | 96 | $value = array_get($where, 'value'); |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | } |
101 | 101 | |
102 | 102 | if (is_array(array_get($where, 'values'))) { |
103 | - $value .= '_' . implode('_', $where['values']); |
|
103 | + $value .= '_'.implode('_', $where['values']); |
|
104 | 104 | } |
105 | 105 | |
106 | 106 | return "{$carry}-{$where['column']}_{$value}"; |
@@ -115,24 +115,24 @@ discard block |
||
115 | 115 | return ''; |
116 | 116 | } |
117 | 117 | |
118 | - return '-' . implode('-', $eagerLoads->keys()->toArray()); |
|
118 | + return '-'.implode('-', $eagerLoads->keys()->toArray()); |
|
119 | 119 | } |
120 | 120 | |
121 | - protected function getOrderByClauses(){ |
|
121 | + protected function getOrderByClauses() { |
|
122 | 122 | $orders = collect($this->query->orders); |
123 | 123 | |
124 | - return $orders->reduce(function($carry, $order){ |
|
125 | - return $carry . '_orderBy_' . $order['column'] . '_' . $order['direction']; |
|
124 | + return $orders->reduce(function($carry, $order) { |
|
125 | + return $carry.'_orderBy_'.$order['column'].'_'.$order['direction']; |
|
126 | 126 | }); |
127 | 127 | } |
128 | 128 | |
129 | 129 | protected function getCacheTags() : array |
130 | 130 | { |
131 | 131 | return collect($this->eagerLoad)->keys() |
132 | - ->map(function ($relationName) { |
|
132 | + ->map(function($relationName) { |
|
133 | 133 | $relation = collect(explode('.', $relationName)) |
134 | - ->reduce(function ($carry, $name) { |
|
135 | - if (! $carry) { |
|
134 | + ->reduce(function($carry, $name) { |
|
135 | + if (!$carry) { |
|
136 | 136 | $carry = $this->model; |
137 | 137 | } |
138 | 138 | |
@@ -153,10 +153,10 @@ discard block |
||
153 | 153 | public function avg($column) |
154 | 154 | { |
155 | 155 | $tags = [str_slug(get_class($this->model))]; |
156 | - $key = str_slug(get_class($this->model)) ."-avg_{$column}"; |
|
156 | + $key = str_slug(get_class($this->model))."-avg_{$column}"; |
|
157 | 157 | |
158 | 158 | return $this->cache($tags) |
159 | - ->rememberForever($key, function () use ($column) { |
|
159 | + ->rememberForever($key, function() use ($column) { |
|
160 | 160 | return parent::avg($column); |
161 | 161 | }); |
162 | 162 | } |
@@ -164,10 +164,10 @@ discard block |
||
164 | 164 | public function count($columns = ['*']) |
165 | 165 | { |
166 | 166 | $tags = [str_slug(get_class($this->model))]; |
167 | - $key = str_slug(get_class($this->model)) ."-count"; |
|
167 | + $key = str_slug(get_class($this->model))."-count"; |
|
168 | 168 | |
169 | 169 | return $this->cache($tags) |
170 | - ->rememberForever($key, function () use ($columns) { |
|
170 | + ->rememberForever($key, function() use ($columns) { |
|
171 | 171 | return parent::count($columns); |
172 | 172 | }); |
173 | 173 | } |
@@ -175,10 +175,10 @@ discard block |
||
175 | 175 | public function cursor() |
176 | 176 | { |
177 | 177 | $tags = [str_slug(get_class($this->model))]; |
178 | - $key = str_slug(get_class($this->model)) ."-cursor"; |
|
178 | + $key = str_slug(get_class($this->model))."-cursor"; |
|
179 | 179 | |
180 | 180 | return $this->cache($tags) |
181 | - ->rememberForever($key, function () { |
|
181 | + ->rememberForever($key, function() { |
|
182 | 182 | return collect(parent::cursor()); |
183 | 183 | }); |
184 | 184 | } |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | $key = $this->getCacheKey($columns, $id); |
193 | 193 | |
194 | 194 | return $this->cache($tags) |
195 | - ->rememberForever($key, function () use ($id, $columns) { |
|
195 | + ->rememberForever($key, function() use ($id, $columns) { |
|
196 | 196 | return parent::find($id, $columns); |
197 | 197 | }); |
198 | 198 | } |
@@ -200,10 +200,10 @@ discard block |
||
200 | 200 | public function first($columns = ['*']) |
201 | 201 | { |
202 | 202 | $tags = $this->getCacheTags(); |
203 | - $key = $this->getCacheKey($columns) . '-first'; |
|
203 | + $key = $this->getCacheKey($columns).'-first'; |
|
204 | 204 | |
205 | 205 | return $this->cache($tags) |
206 | - ->rememberForever($key, function () use ($columns) { |
|
206 | + ->rememberForever($key, function() use ($columns) { |
|
207 | 207 | return parent::first($columns); |
208 | 208 | }); |
209 | 209 | } |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | $key = $this->getCacheKey($columns); |
215 | 215 | |
216 | 216 | return $this->cache($tags) |
217 | - ->rememberForever($key, function () use ($columns) { |
|
217 | + ->rememberForever($key, function() use ($columns) { |
|
218 | 218 | return parent::get($columns); |
219 | 219 | }); |
220 | 220 | } |
@@ -222,10 +222,10 @@ discard block |
||
222 | 222 | public function max($column) |
223 | 223 | { |
224 | 224 | $tags = [str_slug(get_class($this->model))]; |
225 | - $key = str_slug(get_class($this->model)) ."-max_{$column}"; |
|
225 | + $key = str_slug(get_class($this->model))."-max_{$column}"; |
|
226 | 226 | |
227 | 227 | return $this->cache($tags) |
228 | - ->rememberForever($key, function () use ($column) { |
|
228 | + ->rememberForever($key, function() use ($column) { |
|
229 | 229 | return parent::max($column); |
230 | 230 | }); |
231 | 231 | } |
@@ -233,10 +233,10 @@ discard block |
||
233 | 233 | public function min($column) |
234 | 234 | { |
235 | 235 | $tags = [str_slug(get_class($this->model))]; |
236 | - $key = str_slug(get_class($this->model)) ."-min_{$column}"; |
|
236 | + $key = str_slug(get_class($this->model))."-min_{$column}"; |
|
237 | 237 | |
238 | 238 | return $this->cache($tags) |
239 | - ->rememberForever($key, function () use ($column) { |
|
239 | + ->rememberForever($key, function() use ($column) { |
|
240 | 240 | return parent::min($column); |
241 | 241 | }); |
242 | 242 | } |
@@ -244,14 +244,14 @@ discard block |
||
244 | 244 | public function pluck($column, $key = null) |
245 | 245 | { |
246 | 246 | $tags = $this->getCacheTags(); |
247 | - $cacheKey = $this->getCacheKey([$column]) . "-pluck_{$column}"; |
|
247 | + $cacheKey = $this->getCacheKey([$column])."-pluck_{$column}"; |
|
248 | 248 | |
249 | 249 | if ($key) { |
250 | 250 | $cacheKey .= "_{$key}"; |
251 | 251 | } |
252 | 252 | |
253 | 253 | return $this->cache($tags) |
254 | - ->rememberForever($cacheKey, function () use ($column, $key) { |
|
254 | + ->rememberForever($cacheKey, function() use ($column, $key) { |
|
255 | 255 | return parent::pluck($column, $key); |
256 | 256 | }); |
257 | 257 | } |
@@ -259,10 +259,10 @@ discard block |
||
259 | 259 | public function sum($column) |
260 | 260 | { |
261 | 261 | $tags = [str_slug(get_class($this->model))]; |
262 | - $key = str_slug(get_class($this->model)) ."-sum_{$column}"; |
|
262 | + $key = str_slug(get_class($this->model))."-sum_{$column}"; |
|
263 | 263 | |
264 | 264 | return $this->cache($tags) |
265 | - ->rememberForever($key, function () use ($column) { |
|
265 | + ->rememberForever($key, function() use ($column) { |
|
266 | 266 | return parent::sum($column); |
267 | 267 | }); |
268 | 268 | } |