@@ -9,10 +9,10 @@ |
||
9 | 9 | { |
10 | 10 | return collect($builder->eagerLoad) |
11 | 11 | ->keys() |
12 | - ->map(function ($relationName) use ($builder) { |
|
12 | + ->map(function($relationName) use ($builder) { |
|
13 | 13 | $relation = collect(explode('.', $relationName)) |
14 | - ->reduce(function ($carry, $name) use ($builder) { |
|
15 | - if (! $carry) { |
|
14 | + ->reduce(function($carry, $name) use ($builder) { |
|
15 | + if (!$carry) { |
|
16 | 16 | $carry = $builder->model; |
17 | 17 | } |
18 | 18 |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | |
30 | 30 | protected function getLimitClause(CachedBuilder $builder) : string |
31 | 31 | { |
32 | - if (! $builder->query->limit) { |
|
32 | + if (!$builder->query->limit) { |
|
33 | 33 | return ''; |
34 | 34 | } |
35 | 35 | |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | |
44 | 44 | protected function getOffsetClause(CachedBuilder $builder) : string |
45 | 45 | { |
46 | - if (! $builder->query->offset) { |
|
46 | + if (!$builder->query->offset) { |
|
47 | 47 | return ''; |
48 | 48 | } |
49 | 49 | |
@@ -54,8 +54,8 @@ discard block |
||
54 | 54 | { |
55 | 55 | $orders = collect($builder->query->orders); |
56 | 56 | |
57 | - return $orders->reduce(function($carry, $order){ |
|
58 | - return $carry . '_orderBy_' . $order['column'] . '_' . $order['direction']; |
|
57 | + return $orders->reduce(function($carry, $order) { |
|
58 | + return $carry.'_orderBy_'.$order['column'].'_'.$order['direction']; |
|
59 | 59 | }) |
60 | 60 | ?: ''; |
61 | 61 | } |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | return ''; |
67 | 67 | } |
68 | 68 | |
69 | - return '_' . implode('_', $columns); |
|
69 | + return '_'.implode('_', $columns); |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | protected function getTypeClause($where) : string |
@@ -79,16 +79,16 @@ discard block |
||
79 | 79 | protected function getValuesClause(array $where = null) : string |
80 | 80 | { |
81 | 81 | return is_array(array_get($where, 'values')) |
82 | - ? '_' . implode('_', $where['values']) |
|
82 | + ? '_'.implode('_', $where['values']) |
|
83 | 83 | : ''; |
84 | 84 | } |
85 | 85 | |
86 | 86 | protected function getWhereClauses(CachedBuilder $builder, array $wheres = []) : string |
87 | 87 | { |
88 | 88 | return $this->getWheres($builder, $wheres) |
89 | - ->reduce(function ($carry, $where) use ($builder) { |
|
89 | + ->reduce(function($carry, $where) use ($builder) { |
|
90 | 90 | if (in_array($where['type'], ['Exists', 'Nested', 'NotExists'])) { |
91 | - return '_' . strtolower($where['type']) . $this->getWhereClauses($builder, $where['query']->wheres); |
|
91 | + return '_'.strtolower($where['type']).$this->getWhereClauses($builder, $where['query']->wheres); |
|
92 | 92 | } |
93 | 93 | |
94 | 94 | if ($where['type'] === 'Column') { |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | } |
97 | 97 | |
98 | 98 | if ($where['type'] === 'raw') { |
99 | - return "_{$where['boolean']}_" . str_slug($where['sql']); |
|
99 | + return "_{$where['boolean']}_".str_slug($where['sql']); |
|
100 | 100 | } |
101 | 101 | |
102 | 102 | $value = array_get($where, 'value'); |
@@ -127,6 +127,6 @@ discard block |
||
127 | 127 | return ''; |
128 | 128 | } |
129 | 129 | |
130 | - return '-' . implode('-', $eagerLoads->keys()->toArray()); |
|
130 | + return '-'.implode('-', $eagerLoads->keys()->toArray()); |
|
131 | 131 | } |
132 | 132 | } |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | public function avg($column) |
15 | 15 | { |
16 | 16 | return $this->cache($this->makeCacheTags($this)) |
17 | - ->rememberForever($this->makeCacheKey($this) . "-avg_{$column}", function () use ($column) { |
|
17 | + ->rememberForever($this->makeCacheKey($this)."-avg_{$column}", function() use ($column) { |
|
18 | 18 | return parent::avg($column); |
19 | 19 | }); |
20 | 20 | } |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | public function count($columns = ['*']) |
23 | 23 | { |
24 | 24 | return $this->cache($this->makeCacheTags($this)) |
25 | - ->rememberForever($this->makeCacheKey($this) . "-count", function () use ($columns) { |
|
25 | + ->rememberForever($this->makeCacheKey($this)."-count", function() use ($columns) { |
|
26 | 26 | return parent::count($columns); |
27 | 27 | }); |
28 | 28 | } |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | public function cursor() |
31 | 31 | { |
32 | 32 | return $this->cache($this->makeCacheTags($this)) |
33 | - ->rememberForever($this->makeCacheKey($this) . "-cursor", function () { |
|
33 | + ->rememberForever($this->makeCacheKey($this)."-cursor", function() { |
|
34 | 34 | return collect(parent::cursor()); |
35 | 35 | }); |
36 | 36 | } |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | public function find($id, $columns = ['*']) |
42 | 42 | { |
43 | 43 | return $this->cache($this->makeCacheTags($this)) |
44 | - ->rememberForever($this->makeCacheKey($this, $columns, $id), function () use ($id, $columns) { |
|
44 | + ->rememberForever($this->makeCacheKey($this, $columns, $id), function() use ($id, $columns) { |
|
45 | 45 | return parent::find($id, $columns); |
46 | 46 | }); |
47 | 47 | } |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | public function first($columns = ['*']) |
50 | 50 | { |
51 | 51 | return $this->cache($this->makeCacheTags($this)) |
52 | - ->rememberForever($this->makeCacheKey($this, $columns) . '-first', function () use ($columns) { |
|
52 | + ->rememberForever($this->makeCacheKey($this, $columns).'-first', function() use ($columns) { |
|
53 | 53 | return parent::first($columns); |
54 | 54 | }); |
55 | 55 | } |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | public function get($columns = ['*']) |
58 | 58 | { |
59 | 59 | return $this->cache($this->makeCacheTags($this)) |
60 | - ->rememberForever($this->makeCacheKey($this, $columns), function () use ($columns) { |
|
60 | + ->rememberForever($this->makeCacheKey($this, $columns), function() use ($columns) { |
|
61 | 61 | return parent::get($columns); |
62 | 62 | }); |
63 | 63 | } |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | public function max($column) |
66 | 66 | { |
67 | 67 | return $this->cache($this->makeCacheTags($this)) |
68 | - ->rememberForever($this->makeCacheKey($this) . "-max_{$column}", function () use ($column) { |
|
68 | + ->rememberForever($this->makeCacheKey($this)."-max_{$column}", function() use ($column) { |
|
69 | 69 | return parent::max($column); |
70 | 70 | }); |
71 | 71 | } |
@@ -73,21 +73,21 @@ discard block |
||
73 | 73 | public function min($column) |
74 | 74 | { |
75 | 75 | return $this->cache($this->makeCacheTags($this)) |
76 | - ->rememberForever($this->makeCacheKey($this) . "-min_{$column}", function () use ($column) { |
|
76 | + ->rememberForever($this->makeCacheKey($this)."-min_{$column}", function() use ($column) { |
|
77 | 77 | return parent::min($column); |
78 | 78 | }); |
79 | 79 | } |
80 | 80 | |
81 | 81 | public function pluck($column, $key = null) |
82 | 82 | { |
83 | - $cacheKey = $this->makeCacheKey($this, [$column]) . "-pluck_{$column}"; |
|
83 | + $cacheKey = $this->makeCacheKey($this, [$column])."-pluck_{$column}"; |
|
84 | 84 | |
85 | 85 | if ($key) { |
86 | 86 | $cacheKey .= "_{$key}"; |
87 | 87 | } |
88 | 88 | |
89 | 89 | return $this->cache($this->makeCacheTags($this)) |
90 | - ->rememberForever($cacheKey, function () use ($column, $key) { |
|
90 | + ->rememberForever($cacheKey, function() use ($column, $key) { |
|
91 | 91 | return parent::pluck($column, $key); |
92 | 92 | }); |
93 | 93 | } |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | public function sum($column) |
96 | 96 | { |
97 | 97 | return $this->cache($this->makeCacheTags($this)) |
98 | - ->rememberForever($this->makeCacheKey($this) . "-sum_{$column}", function () use ($column) { |
|
98 | + ->rememberForever($this->makeCacheKey($this)."-sum_{$column}", function() use ($column) { |
|
99 | 99 | return parent::sum($column); |
100 | 100 | }); |
101 | 101 | } |