@@ -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,14 +115,14 @@ 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 getOrderClauses(){ |
|
| 121 | + protected function getOrderClauses() { |
|
| 122 | 122 | $orders = collect($this->query->orders); |
| 123 | 123 | |
| 124 | - return $orders->reduce(function($carry, $order){ |
|
| 125 | - $carry .= '_sort_' . array_get($order, 'column') . '_' . array_get($order, 'direction'); |
|
| 124 | + return $orders->reduce(function($carry, $order) { |
|
| 125 | + $carry .= '_sort_'.array_get($order, 'column').'_'.array_get($order, 'direction'); |
|
| 126 | 126 | |
| 127 | 127 | return $carry; |
| 128 | 128 | }); |
@@ -131,10 +131,10 @@ discard block |
||
| 131 | 131 | protected function getCacheTags() : array |
| 132 | 132 | { |
| 133 | 133 | return collect($this->eagerLoad)->keys() |
| 134 | - ->map(function ($relationName) { |
|
| 134 | + ->map(function($relationName) { |
|
| 135 | 135 | $relation = collect(explode('.', $relationName)) |
| 136 | - ->reduce(function ($carry, $name) { |
|
| 137 | - if (! $carry) { |
|
| 136 | + ->reduce(function($carry, $name) { |
|
| 137 | + if (!$carry) { |
|
| 138 | 138 | $carry = $this->model; |
| 139 | 139 | } |
| 140 | 140 | |
@@ -155,10 +155,10 @@ discard block |
||
| 155 | 155 | public function avg($column) |
| 156 | 156 | { |
| 157 | 157 | $tags = [str_slug(get_class($this->model))]; |
| 158 | - $key = str_slug(get_class($this->model)) ."-avg_{$column}"; |
|
| 158 | + $key = str_slug(get_class($this->model))."-avg_{$column}"; |
|
| 159 | 159 | |
| 160 | 160 | return $this->cache($tags) |
| 161 | - ->rememberForever($key, function () use ($column) { |
|
| 161 | + ->rememberForever($key, function() use ($column) { |
|
| 162 | 162 | return parent::avg($column); |
| 163 | 163 | }); |
| 164 | 164 | } |
@@ -166,10 +166,10 @@ discard block |
||
| 166 | 166 | public function count($columns = ['*']) |
| 167 | 167 | { |
| 168 | 168 | $tags = [str_slug(get_class($this->model))]; |
| 169 | - $key = str_slug(get_class($this->model)) ."-count"; |
|
| 169 | + $key = str_slug(get_class($this->model))."-count"; |
|
| 170 | 170 | |
| 171 | 171 | return $this->cache($tags) |
| 172 | - ->rememberForever($key, function () use ($columns) { |
|
| 172 | + ->rememberForever($key, function() use ($columns) { |
|
| 173 | 173 | return parent::count($columns); |
| 174 | 174 | }); |
| 175 | 175 | } |
@@ -177,10 +177,10 @@ discard block |
||
| 177 | 177 | public function cursor() |
| 178 | 178 | { |
| 179 | 179 | $tags = [str_slug(get_class($this->model))]; |
| 180 | - $key = str_slug(get_class($this->model)) ."-cursor"; |
|
| 180 | + $key = str_slug(get_class($this->model))."-cursor"; |
|
| 181 | 181 | |
| 182 | 182 | return $this->cache($tags) |
| 183 | - ->rememberForever($key, function () { |
|
| 183 | + ->rememberForever($key, function() { |
|
| 184 | 184 | return collect(parent::cursor()); |
| 185 | 185 | }); |
| 186 | 186 | } |
@@ -194,7 +194,7 @@ discard block |
||
| 194 | 194 | $key = $this->getCacheKey($columns, $id); |
| 195 | 195 | |
| 196 | 196 | return $this->cache($tags) |
| 197 | - ->rememberForever($key, function () use ($id, $columns) { |
|
| 197 | + ->rememberForever($key, function() use ($id, $columns) { |
|
| 198 | 198 | return parent::find($id, $columns); |
| 199 | 199 | }); |
| 200 | 200 | } |
@@ -202,10 +202,10 @@ discard block |
||
| 202 | 202 | public function first($columns = ['*']) |
| 203 | 203 | { |
| 204 | 204 | $tags = $this->getCacheTags(); |
| 205 | - $key = $this->getCacheKey($columns) . '-first'; |
|
| 205 | + $key = $this->getCacheKey($columns).'-first'; |
|
| 206 | 206 | |
| 207 | 207 | return $this->cache($tags) |
| 208 | - ->rememberForever($key, function () use ($columns) { |
|
| 208 | + ->rememberForever($key, function() use ($columns) { |
|
| 209 | 209 | return parent::first($columns); |
| 210 | 210 | }); |
| 211 | 211 | } |
@@ -216,7 +216,7 @@ discard block |
||
| 216 | 216 | $key = $this->getCacheKey($columns); |
| 217 | 217 | |
| 218 | 218 | return $this->cache($tags) |
| 219 | - ->rememberForever($key, function () use ($columns) { |
|
| 219 | + ->rememberForever($key, function() use ($columns) { |
|
| 220 | 220 | return parent::get($columns); |
| 221 | 221 | }); |
| 222 | 222 | } |
@@ -224,10 +224,10 @@ discard block |
||
| 224 | 224 | public function max($column) |
| 225 | 225 | { |
| 226 | 226 | $tags = [str_slug(get_class($this->model))]; |
| 227 | - $key = str_slug(get_class($this->model)) ."-max_{$column}"; |
|
| 227 | + $key = str_slug(get_class($this->model))."-max_{$column}"; |
|
| 228 | 228 | |
| 229 | 229 | return $this->cache($tags) |
| 230 | - ->rememberForever($key, function () use ($column) { |
|
| 230 | + ->rememberForever($key, function() use ($column) { |
|
| 231 | 231 | return parent::max($column); |
| 232 | 232 | }); |
| 233 | 233 | } |
@@ -235,10 +235,10 @@ discard block |
||
| 235 | 235 | public function min($column) |
| 236 | 236 | { |
| 237 | 237 | $tags = [str_slug(get_class($this->model))]; |
| 238 | - $key = str_slug(get_class($this->model)) ."-min_{$column}"; |
|
| 238 | + $key = str_slug(get_class($this->model))."-min_{$column}"; |
|
| 239 | 239 | |
| 240 | 240 | return $this->cache($tags) |
| 241 | - ->rememberForever($key, function () use ($column) { |
|
| 241 | + ->rememberForever($key, function() use ($column) { |
|
| 242 | 242 | return parent::min($column); |
| 243 | 243 | }); |
| 244 | 244 | } |
@@ -246,14 +246,14 @@ discard block |
||
| 246 | 246 | public function pluck($column, $key = null) |
| 247 | 247 | { |
| 248 | 248 | $tags = $this->getCacheTags(); |
| 249 | - $cacheKey = $this->getCacheKey([$column]) . "-pluck_{$column}"; |
|
| 249 | + $cacheKey = $this->getCacheKey([$column])."-pluck_{$column}"; |
|
| 250 | 250 | |
| 251 | 251 | if ($key) { |
| 252 | 252 | $cacheKey .= "_{$key}"; |
| 253 | 253 | } |
| 254 | 254 | |
| 255 | 255 | return $this->cache($tags) |
| 256 | - ->rememberForever($cacheKey, function () use ($column, $key) { |
|
| 256 | + ->rememberForever($cacheKey, function() use ($column, $key) { |
|
| 257 | 257 | return parent::pluck($column, $key); |
| 258 | 258 | }); |
| 259 | 259 | } |
@@ -261,10 +261,10 @@ discard block |
||
| 261 | 261 | public function sum($column) |
| 262 | 262 | { |
| 263 | 263 | $tags = [str_slug(get_class($this->model))]; |
| 264 | - $key = str_slug(get_class($this->model)) ."-sum_{$column}"; |
|
| 264 | + $key = str_slug(get_class($this->model))."-sum_{$column}"; |
|
| 265 | 265 | |
| 266 | 266 | return $this->cache($tags) |
| 267 | - ->rememberForever($key, function () use ($column) { |
|
| 267 | + ->rememberForever($key, function() use ($column) { |
|
| 268 | 268 | return parent::sum($column); |
| 269 | 269 | }); |
| 270 | 270 | } |