@@ -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 | $value .= $this->getValuesClause($where); |
99 | 99 | |
100 | 100 | return "{$carry}-{$where['column']}_{$value}"; |
101 | - }) . ''; |
|
101 | + }).''; |
|
102 | 102 | } |
103 | 103 | |
104 | 104 | protected function getWithModels() : string |
@@ -109,20 +109,20 @@ discard block |
||
109 | 109 | return ''; |
110 | 110 | } |
111 | 111 | |
112 | - return '-' . implode('-', $eagerLoads->keys()->toArray()); |
|
112 | + return '-'.implode('-', $eagerLoads->keys()->toArray()); |
|
113 | 113 | } |
114 | 114 | |
115 | - protected function getOrderByClauses(){ |
|
115 | + protected function getOrderByClauses() { |
|
116 | 116 | $orders = collect($this->query->orders); |
117 | 117 | |
118 | - return $orders->reduce(function($carry, $order){ |
|
119 | - return $carry . '_orderBy_' . $order['column'] . '_' . $order['direction']; |
|
118 | + return $orders->reduce(function($carry, $order) { |
|
119 | + return $carry.'_orderBy_'.$order['column'].'_'.$order['direction']; |
|
120 | 120 | }); |
121 | 121 | } |
122 | 122 | |
123 | 123 | protected function getMethodKey(string $postfix = null) : string |
124 | 124 | { |
125 | - return str_slug(get_class($this->model)) . $postfix; |
|
125 | + return str_slug(get_class($this->model)).$postfix; |
|
126 | 126 | } |
127 | 127 | |
128 | 128 | protected function getModelTag() : array |
@@ -133,10 +133,10 @@ discard block |
||
133 | 133 | protected function getCacheTags() : array |
134 | 134 | { |
135 | 135 | return collect($this->eagerLoad)->keys() |
136 | - ->map(function ($relationName) { |
|
136 | + ->map(function($relationName) { |
|
137 | 137 | $relation = collect(explode('.', $relationName)) |
138 | - ->reduce(function ($carry, $name) { |
|
139 | - if (! $carry) { |
|
138 | + ->reduce(function($carry, $name) { |
|
139 | + if (!$carry) { |
|
140 | 140 | $carry = $this->model; |
141 | 141 | } |
142 | 142 | |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | public function avg($column) |
158 | 158 | { |
159 | 159 | return $this->cache($this->getModelTag()) |
160 | - ->rememberForever($this->getMethodKey("-avg_{$column}"), function () use ($column) { |
|
160 | + ->rememberForever($this->getMethodKey("-avg_{$column}"), function() use ($column) { |
|
161 | 161 | return parent::avg($column); |
162 | 162 | }); |
163 | 163 | } |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | public function count($columns = ['*']) |
166 | 166 | { |
167 | 167 | return $this->cache($this->getModelTag()) |
168 | - ->rememberForever($this->getMethodKey("-count"), function () use ($columns) { |
|
168 | + ->rememberForever($this->getMethodKey("-count"), function() use ($columns) { |
|
169 | 169 | return parent::count($columns); |
170 | 170 | }); |
171 | 171 | } |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | public function cursor() |
174 | 174 | { |
175 | 175 | return $this->cache($this->getModelTag()) |
176 | - ->rememberForever($this->getMethodKey("-cursor"), function () { |
|
176 | + ->rememberForever($this->getMethodKey("-cursor"), function() { |
|
177 | 177 | return collect(parent::cursor()); |
178 | 178 | }); |
179 | 179 | } |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | public function find($id, $columns = ['*']) |
185 | 185 | { |
186 | 186 | return $this->cache($this->getCacheTags()) |
187 | - ->rememberForever($this->getCacheKey($columns, $id), function () use ($id, $columns) { |
|
187 | + ->rememberForever($this->getCacheKey($columns, $id), function() use ($id, $columns) { |
|
188 | 188 | return parent::find($id, $columns); |
189 | 189 | }); |
190 | 190 | } |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | public function first($columns = ['*']) |
193 | 193 | { |
194 | 194 | return $this->cache($this->getCacheTags()) |
195 | - ->rememberForever($this->getCacheKey($columns) . '-first', function () use ($columns) { |
|
195 | + ->rememberForever($this->getCacheKey($columns).'-first', function() use ($columns) { |
|
196 | 196 | return parent::first($columns); |
197 | 197 | }); |
198 | 198 | } |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | public function get($columns = ['*']) |
201 | 201 | { |
202 | 202 | return $this->cache($this->getCacheTags()) |
203 | - ->rememberForever($this->getCacheKey($columns), function () use ($columns) { |
|
203 | + ->rememberForever($this->getCacheKey($columns), function() use ($columns) { |
|
204 | 204 | return parent::get($columns); |
205 | 205 | }); |
206 | 206 | } |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | public function max($column) |
209 | 209 | { |
210 | 210 | return $this->cache($this->getModelTag()) |
211 | - ->rememberForever($this->getMethodKey("-max_{$column}"), function () use ($column) { |
|
211 | + ->rememberForever($this->getMethodKey("-max_{$column}"), function() use ($column) { |
|
212 | 212 | return parent::max($column); |
213 | 213 | }); |
214 | 214 | } |
@@ -216,21 +216,21 @@ discard block |
||
216 | 216 | public function min($column) |
217 | 217 | { |
218 | 218 | return $this->cache($this->getModelTag()) |
219 | - ->rememberForever($this->getMethodKey("-min_{$column}"), function () use ($column) { |
|
219 | + ->rememberForever($this->getMethodKey("-min_{$column}"), function() use ($column) { |
|
220 | 220 | return parent::min($column); |
221 | 221 | }); |
222 | 222 | } |
223 | 223 | |
224 | 224 | public function pluck($column, $key = null) |
225 | 225 | { |
226 | - $cacheKey = $this->getCacheKey([$column]) . "-pluck_{$column}"; |
|
226 | + $cacheKey = $this->getCacheKey([$column])."-pluck_{$column}"; |
|
227 | 227 | |
228 | 228 | if ($key) { |
229 | 229 | $cacheKey .= "_{$key}"; |
230 | 230 | } |
231 | 231 | |
232 | 232 | return $this->cache($this->getCacheTags()) |
233 | - ->rememberForever($cacheKey, function () use ($column, $key) { |
|
233 | + ->rememberForever($cacheKey, function() use ($column, $key) { |
|
234 | 234 | return parent::pluck($column, $key); |
235 | 235 | }); |
236 | 236 | } |
@@ -238,7 +238,7 @@ discard block |
||
238 | 238 | public function sum($column) |
239 | 239 | { |
240 | 240 | return $this->cache($this->getModelTag()) |
241 | - ->rememberForever($this->getMethodKey("-sum_{$column}"), function () use ($column) { |
|
241 | + ->rememberForever($this->getMethodKey("-sum_{$column}"), function() use ($column) { |
|
242 | 242 | return parent::sum($column); |
243 | 243 | }); |
244 | 244 | } |
@@ -253,7 +253,7 @@ discard block |
||
253 | 253 | protected function getValuesClause($where) |
254 | 254 | { |
255 | 255 | return is_array(array_get($where, 'values')) |
256 | - ? '_' . implode('_', $where['values']) |
|
256 | + ? '_'.implode('_', $where['values']) |
|
257 | 257 | : ''; |
258 | 258 | } |
259 | 259 | } |