@@ -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 | } |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | |
41 | 41 | protected function getLimitClause() : string |
42 | 42 | { |
43 | - if (! $this->query->limit) { |
|
43 | + if (!$this->query->limit) { |
|
44 | 44 | return ''; |
45 | 45 | } |
46 | 46 | |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | |
55 | 55 | protected function getOffsetClause() : string |
56 | 56 | { |
57 | - if (! $this->query->offset) { |
|
57 | + if (!$this->query->offset) { |
|
58 | 58 | return ''; |
59 | 59 | } |
60 | 60 | |
@@ -67,12 +67,12 @@ discard block |
||
67 | 67 | return ''; |
68 | 68 | } |
69 | 69 | |
70 | - return '_' . implode('_', $columns); |
|
70 | + return '_'.implode('_', $columns); |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | protected function getWhereClauses() : string |
74 | 74 | { |
75 | - return collect($this->query->wheres)->reduce(function ($carry, $where) { |
|
75 | + return collect($this->query->wheres)->reduce(function($carry, $where) { |
|
76 | 76 | $value = $where['value'] ?? implode('_', $where['values']) ?? ''; |
77 | 77 | |
78 | 78 | return "{$carry}-{$where['column']}_{$value}"; |
@@ -87,13 +87,13 @@ discard block |
||
87 | 87 | return ''; |
88 | 88 | } |
89 | 89 | |
90 | - return '-' . implode('-', $eagerLoads->keys()->toArray()); |
|
90 | + return '-'.implode('-', $eagerLoads->keys()->toArray()); |
|
91 | 91 | } |
92 | 92 | |
93 | 93 | protected function getCacheTags() : array |
94 | 94 | { |
95 | 95 | return collect($this->eagerLoad)->keys() |
96 | - ->map(function ($name) { |
|
96 | + ->map(function($name) { |
|
97 | 97 | return str_slug(get_class( |
98 | 98 | $this->model |
99 | 99 | ->{$name}() |
@@ -109,10 +109,10 @@ discard block |
||
109 | 109 | public function avg($column) |
110 | 110 | { |
111 | 111 | $tags = [str_slug(get_class($this->model))]; |
112 | - $key = str_slug(get_class($this->model)) ."-avg_{$column}"; |
|
112 | + $key = str_slug(get_class($this->model))."-avg_{$column}"; |
|
113 | 113 | |
114 | 114 | return $this->cache($tags) |
115 | - ->rememberForever($key, function () use ($column) { |
|
115 | + ->rememberForever($key, function() use ($column) { |
|
116 | 116 | return parent::avg($column); |
117 | 117 | }); |
118 | 118 | } |
@@ -120,10 +120,10 @@ discard block |
||
120 | 120 | public function count($columns = ['*']) |
121 | 121 | { |
122 | 122 | $tags = [str_slug(get_class($this->model))]; |
123 | - $key = str_slug(get_class($this->model)) ."-count"; |
|
123 | + $key = str_slug(get_class($this->model))."-count"; |
|
124 | 124 | |
125 | 125 | return $this->cache($tags) |
126 | - ->rememberForever($key, function () use ($columns) { |
|
126 | + ->rememberForever($key, function() use ($columns) { |
|
127 | 127 | return parent::count($columns); |
128 | 128 | }); |
129 | 129 | } |
@@ -131,10 +131,10 @@ discard block |
||
131 | 131 | public function cursor() |
132 | 132 | { |
133 | 133 | $tags = [str_slug(get_class($this->model))]; |
134 | - $key = str_slug(get_class($this->model)) ."-cursor"; |
|
134 | + $key = str_slug(get_class($this->model))."-cursor"; |
|
135 | 135 | |
136 | 136 | return $this->cache($tags) |
137 | - ->rememberForever($key, function () { |
|
137 | + ->rememberForever($key, function() { |
|
138 | 138 | return collect(parent::cursor()); |
139 | 139 | }); |
140 | 140 | } |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | $key = $this->getCacheKey($columns, $id); |
149 | 149 | |
150 | 150 | return $this->cache($tags) |
151 | - ->rememberForever($key, function () use ($id, $columns) { |
|
151 | + ->rememberForever($key, function() use ($id, $columns) { |
|
152 | 152 | return parent::find($id, $columns); |
153 | 153 | }); |
154 | 154 | } |
@@ -156,10 +156,10 @@ discard block |
||
156 | 156 | public function first($columns = ['*']) |
157 | 157 | { |
158 | 158 | $tags = $this->getCacheTags(); |
159 | - $key = $this->getCacheKey($columns) . '-first'; |
|
159 | + $key = $this->getCacheKey($columns).'-first'; |
|
160 | 160 | |
161 | 161 | return $this->cache($tags) |
162 | - ->rememberForever($key, function () use ($columns) { |
|
162 | + ->rememberForever($key, function() use ($columns) { |
|
163 | 163 | return parent::first($columns); |
164 | 164 | }); |
165 | 165 | } |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | $key = $this->getCacheKey($columns); |
171 | 171 | |
172 | 172 | return $this->cache($tags) |
173 | - ->rememberForever($key, function () use ($columns) { |
|
173 | + ->rememberForever($key, function() use ($columns) { |
|
174 | 174 | return parent::get($columns); |
175 | 175 | }); |
176 | 176 | } |
@@ -178,10 +178,10 @@ discard block |
||
178 | 178 | public function max($column) |
179 | 179 | { |
180 | 180 | $tags = [str_slug(get_class($this->model))]; |
181 | - $key = str_slug(get_class($this->model)) ."-max_{$column}"; |
|
181 | + $key = str_slug(get_class($this->model))."-max_{$column}"; |
|
182 | 182 | |
183 | 183 | return $this->cache($tags) |
184 | - ->rememberForever($key, function () use ($column) { |
|
184 | + ->rememberForever($key, function() use ($column) { |
|
185 | 185 | return parent::max($column); |
186 | 186 | }); |
187 | 187 | } |
@@ -189,10 +189,10 @@ discard block |
||
189 | 189 | public function min($column) |
190 | 190 | { |
191 | 191 | $tags = [str_slug(get_class($this->model))]; |
192 | - $key = str_slug(get_class($this->model)) ."-min_{$column}"; |
|
192 | + $key = str_slug(get_class($this->model))."-min_{$column}"; |
|
193 | 193 | |
194 | 194 | return $this->cache($tags) |
195 | - ->rememberForever($key, function () use ($column) { |
|
195 | + ->rememberForever($key, function() use ($column) { |
|
196 | 196 | return parent::min($column); |
197 | 197 | }); |
198 | 198 | } |
@@ -200,14 +200,14 @@ discard block |
||
200 | 200 | public function pluck($column, $key = null) |
201 | 201 | { |
202 | 202 | $tags = $this->getCacheTags(); |
203 | - $cacheKey = $this->getCacheKey([$column]) . "-pluck_{$column}"; |
|
203 | + $cacheKey = $this->getCacheKey([$column])."-pluck_{$column}"; |
|
204 | 204 | |
205 | 205 | if ($key) { |
206 | 206 | $cacheKey .= "_{$key}"; |
207 | 207 | } |
208 | 208 | |
209 | 209 | return $this->cache($tags) |
210 | - ->rememberForever($cacheKey, function () use ($column, $key) { |
|
210 | + ->rememberForever($cacheKey, function() use ($column, $key) { |
|
211 | 211 | return parent::pluck($column, $key); |
212 | 212 | }); |
213 | 213 | } |
@@ -215,10 +215,10 @@ discard block |
||
215 | 215 | public function sum($column) |
216 | 216 | { |
217 | 217 | $tags = [str_slug(get_class($this->model))]; |
218 | - $key = str_slug(get_class($this->model)) ."-sum_{$column}"; |
|
218 | + $key = str_slug(get_class($this->model))."-sum_{$column}"; |
|
219 | 219 | |
220 | 220 | return $this->cache($tags) |
221 | - ->rememberForever($key, function () use ($column) { |
|
221 | + ->rememberForever($key, function() use ($column) { |
|
222 | 222 | return parent::sum($column); |
223 | 223 | }); |
224 | 224 | } |