@@ -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,9 +80,9 @@ 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', 'NotExists'])) { |
85 | - return '_' . strtolower($where['type']) . $this->getWhereClauses($where['query']->wheres); |
|
85 | + return '_'.strtolower($where['type']).$this->getWhereClauses($where['query']->wheres); |
|
86 | 86 | } |
87 | 87 | |
88 | 88 | if ($where['type'] === 'Column') { |
@@ -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'); |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | ? strtolower($where['type']) |
99 | 99 | : ''; |
100 | 100 | $value .= is_array(array_get($where, 'values')) |
101 | - ? '_' . implode('_', $where['values']) |
|
101 | + ? '_'.implode('_', $where['values']) |
|
102 | 102 | : ''; |
103 | 103 | |
104 | 104 | return "{$carry}-{$where['column']}_{$value}"; |
@@ -113,20 +113,20 @@ discard block |
||
113 | 113 | return ''; |
114 | 114 | } |
115 | 115 | |
116 | - return '-' . implode('-', $eagerLoads->keys()->toArray()); |
|
116 | + return '-'.implode('-', $eagerLoads->keys()->toArray()); |
|
117 | 117 | } |
118 | 118 | |
119 | - protected function getOrderByClauses(){ |
|
119 | + protected function getOrderByClauses() { |
|
120 | 120 | $orders = collect($this->query->orders); |
121 | 121 | |
122 | - return $orders->reduce(function($carry, $order){ |
|
123 | - return $carry . '_orderBy_' . $order['column'] . '_' . $order['direction']; |
|
122 | + return $orders->reduce(function($carry, $order) { |
|
123 | + return $carry.'_orderBy_'.$order['column'].'_'.$order['direction']; |
|
124 | 124 | }); |
125 | 125 | } |
126 | 126 | |
127 | 127 | protected function getMethodKey(string $postfix = null) : string |
128 | 128 | { |
129 | - return str_slug(get_class($this->model)) . $postfix; |
|
129 | + return str_slug(get_class($this->model)).$postfix; |
|
130 | 130 | } |
131 | 131 | |
132 | 132 | protected function getModelTag() : array |
@@ -137,10 +137,10 @@ discard block |
||
137 | 137 | protected function getCacheTags() : array |
138 | 138 | { |
139 | 139 | return collect($this->eagerLoad)->keys() |
140 | - ->map(function ($relationName) { |
|
140 | + ->map(function($relationName) { |
|
141 | 141 | $relation = collect(explode('.', $relationName)) |
142 | - ->reduce(function ($carry, $name) { |
|
143 | - if (! $carry) { |
|
142 | + ->reduce(function($carry, $name) { |
|
143 | + if (!$carry) { |
|
144 | 144 | $carry = $this->model; |
145 | 145 | } |
146 | 146 | |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | public function avg($column) |
162 | 162 | { |
163 | 163 | return $this->cache($this->getModelTag()) |
164 | - ->rememberForever($this->getMethodKey("-avg_{$column}"), function () use ($column) { |
|
164 | + ->rememberForever($this->getMethodKey("-avg_{$column}"), function() use ($column) { |
|
165 | 165 | return parent::avg($column); |
166 | 166 | }); |
167 | 167 | } |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | public function count($columns = ['*']) |
170 | 170 | { |
171 | 171 | return $this->cache($this->getModelTag()) |
172 | - ->rememberForever($this->getMethodKey("-count"), function () use ($columns) { |
|
172 | + ->rememberForever($this->getMethodKey("-count"), function() use ($columns) { |
|
173 | 173 | return parent::count($columns); |
174 | 174 | }); |
175 | 175 | } |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | public function cursor() |
178 | 178 | { |
179 | 179 | return $this->cache($this->getModelTag()) |
180 | - ->rememberForever($this->getMethodKey("-cursor"), function () { |
|
180 | + ->rememberForever($this->getMethodKey("-cursor"), function() { |
|
181 | 181 | return collect(parent::cursor()); |
182 | 182 | }); |
183 | 183 | } |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | public function find($id, $columns = ['*']) |
189 | 189 | { |
190 | 190 | return $this->cache($this->getCacheTags()) |
191 | - ->rememberForever($this->getCacheKey($columns, $id), function () use ($id, $columns) { |
|
191 | + ->rememberForever($this->getCacheKey($columns, $id), function() use ($id, $columns) { |
|
192 | 192 | return parent::find($id, $columns); |
193 | 193 | }); |
194 | 194 | } |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | public function first($columns = ['*']) |
197 | 197 | { |
198 | 198 | return $this->cache($this->getCacheTags()) |
199 | - ->rememberForever($this->getCacheKey($columns) . '-first', function () use ($columns) { |
|
199 | + ->rememberForever($this->getCacheKey($columns).'-first', function() use ($columns) { |
|
200 | 200 | return parent::first($columns); |
201 | 201 | }); |
202 | 202 | } |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | public function get($columns = ['*']) |
205 | 205 | { |
206 | 206 | return $this->cache($this->getCacheTags()) |
207 | - ->rememberForever($this->getCacheKey($columns), function () use ($columns) { |
|
207 | + ->rememberForever($this->getCacheKey($columns), function() use ($columns) { |
|
208 | 208 | return parent::get($columns); |
209 | 209 | }); |
210 | 210 | } |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | public function max($column) |
213 | 213 | { |
214 | 214 | return $this->cache($this->getModelTag()) |
215 | - ->rememberForever($this->getMethodKey("-max_{$column}"), function () use ($column) { |
|
215 | + ->rememberForever($this->getMethodKey("-max_{$column}"), function() use ($column) { |
|
216 | 216 | return parent::max($column); |
217 | 217 | }); |
218 | 218 | } |
@@ -220,21 +220,21 @@ discard block |
||
220 | 220 | public function min($column) |
221 | 221 | { |
222 | 222 | return $this->cache($this->getModelTag()) |
223 | - ->rememberForever($this->getMethodKey("-min_{$column}"), function () use ($column) { |
|
223 | + ->rememberForever($this->getMethodKey("-min_{$column}"), function() use ($column) { |
|
224 | 224 | return parent::min($column); |
225 | 225 | }); |
226 | 226 | } |
227 | 227 | |
228 | 228 | public function pluck($column, $key = null) |
229 | 229 | { |
230 | - $cacheKey = $this->getCacheKey([$column]) . "-pluck_{$column}"; |
|
230 | + $cacheKey = $this->getCacheKey([$column])."-pluck_{$column}"; |
|
231 | 231 | |
232 | 232 | if ($key) { |
233 | 233 | $cacheKey .= "_{$key}"; |
234 | 234 | } |
235 | 235 | |
236 | 236 | return $this->cache($this->getCacheTags()) |
237 | - ->rememberForever($cacheKey, function () use ($column, $key) { |
|
237 | + ->rememberForever($cacheKey, function() use ($column, $key) { |
|
238 | 238 | return parent::pluck($column, $key); |
239 | 239 | }); |
240 | 240 | } |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | public function sum($column) |
243 | 243 | { |
244 | 244 | return $this->cache($this->getModelTag()) |
245 | - ->rememberForever($this->getMethodKey("-sum_{$column}"), function () use ($column) { |
|
245 | + ->rememberForever($this->getMethodKey("-sum_{$column}"), function() use ($column) { |
|
246 | 246 | return parent::sum($column); |
247 | 247 | }); |
248 | 248 | } |