@@ -23,19 +23,19 @@ discard block |
||
23 | 23 | $class = get_called_class(); |
24 | 24 | $instance = new $class; |
25 | 25 | |
26 | - static::created(function () use ($instance) { |
|
26 | + static::created(function() use ($instance) { |
|
27 | 27 | $instance->flushCache(); |
28 | 28 | }); |
29 | 29 | |
30 | - static::deleted(function () use ($instance) { |
|
30 | + static::deleted(function() use ($instance) { |
|
31 | 31 | $instance->flushCache(); |
32 | 32 | }); |
33 | 33 | |
34 | - static::saved(function () use ($instance) { |
|
34 | + static::saved(function() use ($instance) { |
|
35 | 35 | $instance->flushCache(); |
36 | 36 | }); |
37 | 37 | |
38 | - static::updated(function () use ($instance) { |
|
38 | + static::updated(function() use ($instance) { |
|
39 | 39 | $instance->flushCache(); |
40 | 40 | }); |
41 | 41 | } |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | $key = 'genealabslaravelmodelcachingtestsfixturesauthor'; |
66 | 66 | |
67 | 67 | return $instance->cache($tags) |
68 | - ->rememberForever($key, function () use ($columns) { |
|
68 | + ->rememberForever($key, function() use ($columns) { |
|
69 | 69 | return parent::all($columns); |
70 | 70 | }); |
71 | 71 | } |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | public function avg($column) |
15 | 15 | { |
16 | 16 | return $this->cache($this->makeCacheTags()) |
17 | - ->rememberForever($this->makeCacheKey() . "-avg_{$column}", function () use ($column) { |
|
17 | + ->rememberForever($this->makeCacheKey()."-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()) |
25 | - ->rememberForever($this->makeCacheKey() . "-count", function () use ($columns) { |
|
25 | + ->rememberForever($this->makeCacheKey()."-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()) |
33 | - ->rememberForever($this->makeCacheKey() . "-cursor", function () { |
|
33 | + ->rememberForever($this->makeCacheKey()."-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()) |
44 | - ->rememberForever($this->makeCacheKey($columns, $id), function () use ($id, $columns) { |
|
44 | + ->rememberForever($this->makeCacheKey($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()) |
52 | - ->rememberForever($this->makeCacheKey($columns) . '-first', function () use ($columns) { |
|
52 | + ->rememberForever($this->makeCacheKey($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()) |
60 | - ->rememberForever($this->makeCacheKey($columns), function () use ($columns) { |
|
60 | + ->rememberForever($this->makeCacheKey($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()) |
68 | - ->rememberForever($this->makeCacheKey() . "-max_{$column}", function () use ($column) { |
|
68 | + ->rememberForever($this->makeCacheKey()."-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()) |
76 | - ->rememberForever($this->makeCacheKey() . "-min_{$column}", function () use ($column) { |
|
76 | + ->rememberForever($this->makeCacheKey()."-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([$column]) . "-pluck_{$column}"; |
|
83 | + $cacheKey = $this->makeCacheKey([$column])."-pluck_{$column}"; |
|
84 | 84 | |
85 | 85 | if ($key) { |
86 | 86 | $cacheKey .= "_{$key}"; |
87 | 87 | } |
88 | 88 | |
89 | 89 | return $this->cache($this->makeCacheTags()) |
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()) |
98 | - ->rememberForever($this->makeCacheKey() . "-sum_{$column}", function () use ($column) { |
|
98 | + ->rememberForever($this->makeCacheKey()."-sum_{$column}", function() use ($column) { |
|
99 | 99 | return parent::sum($column); |
100 | 100 | }); |
101 | 101 | } |
@@ -8,10 +8,10 @@ |
||
8 | 8 | { |
9 | 9 | return collect($this->eagerLoad) |
10 | 10 | ->keys() |
11 | - ->map(function ($relationName) { |
|
11 | + ->map(function($relationName) { |
|
12 | 12 | $relation = collect(explode('.', $relationName)) |
13 | - ->reduce(function ($carry, $name) { |
|
14 | - if (! $carry) { |
|
13 | + ->reduce(function($carry, $name) { |
|
14 | + if (!$carry) { |
|
15 | 15 | $carry = $this->model; |
16 | 16 | } |
17 | 17 |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | |
39 | 39 | protected function getLimitClause() : string |
40 | 40 | { |
41 | - if (! $this->query->limit) { |
|
41 | + if (!$this->query->limit) { |
|
42 | 42 | return ''; |
43 | 43 | } |
44 | 44 | |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | |
53 | 53 | protected function getOffsetClause() : string |
54 | 54 | { |
55 | - if (! $this->query->offset) { |
|
55 | + if (!$this->query->offset) { |
|
56 | 56 | return ''; |
57 | 57 | } |
58 | 58 | |
@@ -63,8 +63,8 @@ discard block |
||
63 | 63 | { |
64 | 64 | $orders = collect($this->query->orders); |
65 | 65 | |
66 | - return $orders->reduce(function ($carry, $order) { |
|
67 | - return $carry . '_orderBy_' . $order['column'] . '_' . $order['direction']; |
|
66 | + return $orders->reduce(function($carry, $order) { |
|
67 | + return $carry.'_orderBy_'.$order['column'].'_'.$order['direction']; |
|
68 | 68 | }) |
69 | 69 | ?: ''; |
70 | 70 | } |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | return ''; |
76 | 76 | } |
77 | 77 | |
78 | - return '_' . implode('_', $columns); |
|
78 | + return '_'.implode('_', $columns); |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | protected function getTypeClause($where) : string |
@@ -88,14 +88,14 @@ discard block |
||
88 | 88 | protected function getValuesClause(array $where = null) : string |
89 | 89 | { |
90 | 90 | return is_array(array_get($where, 'values')) |
91 | - ? '_' . implode('_', $where['values']) |
|
91 | + ? '_'.implode('_', $where['values']) |
|
92 | 92 | : ''; |
93 | 93 | } |
94 | 94 | |
95 | 95 | protected function getWhereClauses(array $wheres = []) : string |
96 | 96 | { |
97 | 97 | return $this->getWheres($wheres) |
98 | - ->reduce(function ($carry, $where) { |
|
98 | + ->reduce(function($carry, $where) { |
|
99 | 99 | $value = $this->getNestedClauses($where); |
100 | 100 | $value .= $this->getColumnClauses($where); |
101 | 101 | $value .= $this->getRawClauses($where); |
@@ -108,11 +108,11 @@ discard block |
||
108 | 108 | |
109 | 109 | protected function getNestedClauses(array $where) : string |
110 | 110 | { |
111 | - if (! in_array($where['type'], ['Exists', 'Nested', 'NotExists'])) { |
|
111 | + if (!in_array($where['type'], ['Exists', 'Nested', 'NotExists'])) { |
|
112 | 112 | return ''; |
113 | 113 | } |
114 | 114 | |
115 | - return '_' . strtolower($where['type']) . $this->getWhereClauses($where['query']->wheres); |
|
115 | + return '_'.strtolower($where['type']).$this->getWhereClauses($where['query']->wheres); |
|
116 | 116 | } |
117 | 117 | |
118 | 118 | protected function getColumnClauses(array $where) : string |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | return ''; |
131 | 131 | } |
132 | 132 | |
133 | - return "_{$where['boolean']}_" . str_slug($where['sql']); |
|
133 | + return "_{$where['boolean']}_".str_slug($where['sql']); |
|
134 | 134 | } |
135 | 135 | |
136 | 136 | protected function getOtherClauses(array $where, string $carry = null) : string |
@@ -165,6 +165,6 @@ discard block |
||
165 | 165 | return ''; |
166 | 166 | } |
167 | 167 | |
168 | - return '-' . implode('-', $eagerLoads->keys()->toArray()); |
|
168 | + return '-'.implode('-', $eagerLoads->keys()->toArray()); |
|
169 | 169 | } |
170 | 170 | } |