@@ -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,15 +69,15 @@ 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 |
| 76 | 76 | { |
| 77 | 77 | return $this->getWheres($wheres) |
| 78 | - ->reduce(function ($carry, $where) { |
|
| 78 | + ->reduce(function($carry, $where) { |
|
| 79 | 79 | if (in_array($where['type'], ['Exists', 'Nested', 'NotExists'])) { |
| 80 | - return '_' . strtolower($where['type']) . $this->getWhereClauses($where['query']->wheres); |
|
| 80 | + return '_'.strtolower($where['type']).$this->getWhereClauses($where['query']->wheres); |
|
| 81 | 81 | } |
| 82 | 82 | |
| 83 | 83 | if ($where['type'] === 'Column') { |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | } |
| 86 | 86 | |
| 87 | 87 | if ($where['type'] === 'raw') { |
| 88 | - return "_{$where['boolean']}_" . str_slug($where['sql']); |
|
| 88 | + return "_{$where['boolean']}_".str_slug($where['sql']); |
|
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | $value = array_get($where, 'value'); |
@@ -105,20 +105,20 @@ discard block |
||
| 105 | 105 | return ''; |
| 106 | 106 | } |
| 107 | 107 | |
| 108 | - return '-' . implode('-', $eagerLoads->keys()->toArray()); |
|
| 108 | + return '-'.implode('-', $eagerLoads->keys()->toArray()); |
|
| 109 | 109 | } |
| 110 | 110 | |
| 111 | - protected function getOrderByClauses(){ |
|
| 111 | + protected function getOrderByClauses() { |
|
| 112 | 112 | $orders = collect($this->query->orders); |
| 113 | 113 | |
| 114 | - return $orders->reduce(function($carry, $order){ |
|
| 115 | - return $carry . '_orderBy_' . $order['column'] . '_' . $order['direction']; |
|
| 114 | + return $orders->reduce(function($carry, $order) { |
|
| 115 | + return $carry.'_orderBy_'.$order['column'].'_'.$order['direction']; |
|
| 116 | 116 | }); |
| 117 | 117 | } |
| 118 | 118 | |
| 119 | 119 | protected function getMethodKey(string $postfix = null) : string |
| 120 | 120 | { |
| 121 | - return str_slug(get_class($this->model)) . $postfix; |
|
| 121 | + return str_slug(get_class($this->model)).$postfix; |
|
| 122 | 122 | } |
| 123 | 123 | |
| 124 | 124 | protected function getModelTag() : array |
@@ -129,10 +129,10 @@ discard block |
||
| 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,7 +153,7 @@ discard block |
||
| 153 | 153 | public function avg($column) |
| 154 | 154 | { |
| 155 | 155 | return $this->cache($this->getModelTag()) |
| 156 | - ->rememberForever($this->getMethodKey("-avg_{$column}"), function () use ($column) { |
|
| 156 | + ->rememberForever($this->getMethodKey("-avg_{$column}"), function() use ($column) { |
|
| 157 | 157 | return parent::avg($column); |
| 158 | 158 | }); |
| 159 | 159 | } |
@@ -161,7 +161,7 @@ discard block |
||
| 161 | 161 | public function count($columns = ['*']) |
| 162 | 162 | { |
| 163 | 163 | return $this->cache($this->getModelTag()) |
| 164 | - ->rememberForever($this->getMethodKey("-count"), function () use ($columns) { |
|
| 164 | + ->rememberForever($this->getMethodKey("-count"), function() use ($columns) { |
|
| 165 | 165 | return parent::count($columns); |
| 166 | 166 | }); |
| 167 | 167 | } |
@@ -169,7 +169,7 @@ discard block |
||
| 169 | 169 | public function cursor() |
| 170 | 170 | { |
| 171 | 171 | return $this->cache($this->getModelTag()) |
| 172 | - ->rememberForever($this->getMethodKey("-cursor"), function () { |
|
| 172 | + ->rememberForever($this->getMethodKey("-cursor"), function() { |
|
| 173 | 173 | return collect(parent::cursor()); |
| 174 | 174 | }); |
| 175 | 175 | } |
@@ -180,7 +180,7 @@ discard block |
||
| 180 | 180 | public function find($id, $columns = ['*']) |
| 181 | 181 | { |
| 182 | 182 | return $this->cache($this->getCacheTags()) |
| 183 | - ->rememberForever($this->getCacheKey($columns, $id), function () use ($id, $columns) { |
|
| 183 | + ->rememberForever($this->getCacheKey($columns, $id), function() use ($id, $columns) { |
|
| 184 | 184 | return parent::find($id, $columns); |
| 185 | 185 | }); |
| 186 | 186 | } |
@@ -188,7 +188,7 @@ discard block |
||
| 188 | 188 | public function first($columns = ['*']) |
| 189 | 189 | { |
| 190 | 190 | return $this->cache($this->getCacheTags()) |
| 191 | - ->rememberForever($this->getCacheKey($columns) . '-first', function () use ($columns) { |
|
| 191 | + ->rememberForever($this->getCacheKey($columns).'-first', function() use ($columns) { |
|
| 192 | 192 | return parent::first($columns); |
| 193 | 193 | }); |
| 194 | 194 | } |
@@ -196,7 +196,7 @@ discard block |
||
| 196 | 196 | public function get($columns = ['*']) |
| 197 | 197 | { |
| 198 | 198 | return $this->cache($this->getCacheTags()) |
| 199 | - ->rememberForever($this->getCacheKey($columns), function () use ($columns) { |
|
| 199 | + ->rememberForever($this->getCacheKey($columns), function() use ($columns) { |
|
| 200 | 200 | return parent::get($columns); |
| 201 | 201 | }); |
| 202 | 202 | } |
@@ -204,7 +204,7 @@ discard block |
||
| 204 | 204 | public function max($column) |
| 205 | 205 | { |
| 206 | 206 | return $this->cache($this->getModelTag()) |
| 207 | - ->rememberForever($this->getMethodKey("-max_{$column}"), function () use ($column) { |
|
| 207 | + ->rememberForever($this->getMethodKey("-max_{$column}"), function() use ($column) { |
|
| 208 | 208 | return parent::max($column); |
| 209 | 209 | }); |
| 210 | 210 | } |
@@ -212,21 +212,21 @@ discard block |
||
| 212 | 212 | public function min($column) |
| 213 | 213 | { |
| 214 | 214 | return $this->cache($this->getModelTag()) |
| 215 | - ->rememberForever($this->getMethodKey("-min_{$column}"), function () use ($column) { |
|
| 215 | + ->rememberForever($this->getMethodKey("-min_{$column}"), function() use ($column) { |
|
| 216 | 216 | return parent::min($column); |
| 217 | 217 | }); |
| 218 | 218 | } |
| 219 | 219 | |
| 220 | 220 | public function pluck($column, $key = null) |
| 221 | 221 | { |
| 222 | - $cacheKey = $this->getCacheKey([$column]) . "-pluck_{$column}"; |
|
| 222 | + $cacheKey = $this->getCacheKey([$column])."-pluck_{$column}"; |
|
| 223 | 223 | |
| 224 | 224 | if ($key) { |
| 225 | 225 | $cacheKey .= "_{$key}"; |
| 226 | 226 | } |
| 227 | 227 | |
| 228 | 228 | return $this->cache($this->getCacheTags()) |
| 229 | - ->rememberForever($cacheKey, function () use ($column, $key) { |
|
| 229 | + ->rememberForever($cacheKey, function() use ($column, $key) { |
|
| 230 | 230 | return parent::pluck($column, $key); |
| 231 | 231 | }); |
| 232 | 232 | } |
@@ -234,7 +234,7 @@ discard block |
||
| 234 | 234 | public function sum($column) |
| 235 | 235 | { |
| 236 | 236 | return $this->cache($this->getModelTag()) |
| 237 | - ->rememberForever($this->getMethodKey("-sum_{$column}"), function () use ($column) { |
|
| 237 | + ->rememberForever($this->getMethodKey("-sum_{$column}"), function() use ($column) { |
|
| 238 | 238 | return parent::sum($column); |
| 239 | 239 | }); |
| 240 | 240 | } |
@@ -249,7 +249,7 @@ discard block |
||
| 249 | 249 | protected function getValuesClause($where) |
| 250 | 250 | { |
| 251 | 251 | return is_array(array_get($where, 'values')) |
| 252 | - ? '_' . implode('_', $where['values']) |
|
| 252 | + ? '_'.implode('_', $where['values']) |
|
| 253 | 253 | : ''; |
| 254 | 254 | } |
| 255 | 255 | |