@@ -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 |
@@ -9,7 +9,7 @@ |
||
9 | 9 | |
10 | 10 | public function boot() |
11 | 11 | { |
12 | - $configPath = __DIR__ . '/../../config/laravel-model-caching.php'; |
|
12 | + $configPath = __DIR__.'/../../config/laravel-model-caching.php'; |
|
13 | 13 | $this->mergeConfigFrom($configPath, 'laravel-model-caching'); |
14 | 14 | $this->commands(Flush::class); |
15 | 15 | } |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | |
44 | 44 | protected function getLimitClause() : string |
45 | 45 | { |
46 | - if (! $this->query->limit) { |
|
46 | + if (!$this->query->limit) { |
|
47 | 47 | return ''; |
48 | 48 | } |
49 | 49 | |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | |
58 | 58 | protected function getOffsetClause() : string |
59 | 59 | { |
60 | - if (! $this->query->offset) { |
|
60 | + if (!$this->query->offset) { |
|
61 | 61 | return ''; |
62 | 62 | } |
63 | 63 | |
@@ -69,12 +69,12 @@ discard block |
||
69 | 69 | $orders = collect($this->query->orders); |
70 | 70 | |
71 | 71 | return $orders |
72 | - ->reduce(function ($carry, $order) { |
|
72 | + ->reduce(function($carry, $order) { |
|
73 | 73 | if (($order['type'] ?? '') === 'Raw') { |
74 | - return $carry . '_orderByRaw_' . str_slug($order['sql']); |
|
74 | + return $carry.'_orderByRaw_'.str_slug($order['sql']); |
|
75 | 75 | } |
76 | 76 | |
77 | - return $carry . '_orderBy_' . $order['column'] . '_' . $order['direction']; |
|
77 | + return $carry.'_orderBy_'.$order['column'].'_'.$order['direction']; |
|
78 | 78 | }) |
79 | 79 | ?: ''; |
80 | 80 | } |
@@ -85,12 +85,12 @@ discard block |
||
85 | 85 | return ''; |
86 | 86 | } |
87 | 87 | |
88 | - return '_' . implode('_', $columns); |
|
88 | + return '_'.implode('_', $columns); |
|
89 | 89 | } |
90 | 90 | |
91 | 91 | protected function getTypeClause($where) : string |
92 | 92 | { |
93 | - $type =in_array($where['type'], ['In', 'NotIn', 'Null', 'NotNull', 'between']) |
|
93 | + $type = in_array($where['type'], ['In', 'NotIn', 'Null', 'NotNull', 'between']) |
|
94 | 94 | ? strtolower($where['type']) |
95 | 95 | : strtolower($where['operator']); |
96 | 96 | |
@@ -107,17 +107,17 @@ discard block |
||
107 | 107 | ? implode('_', $where['values']) |
108 | 108 | : ''; |
109 | 109 | |
110 | - if (! $values && $this->query->bindings['where'] ?? false) { |
|
110 | + if (!$values && $this->query->bindings['where'] ?? false) { |
|
111 | 111 | $values = implode('_', $this->query->bindings['where']); |
112 | 112 | } |
113 | 113 | |
114 | - return '_' . $values; |
|
114 | + return '_'.$values; |
|
115 | 115 | } |
116 | 116 | |
117 | 117 | protected function getWhereClauses(array $wheres = []) : string |
118 | 118 | { |
119 | 119 | return $this->getWheres($wheres) |
120 | - ->reduce(function ($carry, $where) { |
|
120 | + ->reduce(function($carry, $where) { |
|
121 | 121 | $value = $this->getNestedClauses($where); |
122 | 122 | $value .= $this->getColumnClauses($where); |
123 | 123 | $value .= $this->getRawClauses($where); |
@@ -130,11 +130,11 @@ discard block |
||
130 | 130 | |
131 | 131 | protected function getNestedClauses(array $where) : string |
132 | 132 | { |
133 | - if (! in_array($where['type'], ['Exists', 'Nested', 'NotExists'])) { |
|
133 | + if (!in_array($where['type'], ['Exists', 'Nested', 'NotExists'])) { |
|
134 | 134 | return ''; |
135 | 135 | } |
136 | 136 | |
137 | - return '_' . strtolower($where['type']) . $this->getWhereClauses($where['query']->wheres); |
|
137 | + return '_'.strtolower($where['type']).$this->getWhereClauses($where['query']->wheres); |
|
138 | 138 | } |
139 | 139 | |
140 | 140 | protected function getColumnClauses(array $where) : string |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | return ''; |
153 | 153 | } |
154 | 154 | |
155 | - return "_{$where['boolean']}_" . str_slug($where['sql']); |
|
155 | + return "_{$where['boolean']}_".str_slug($where['sql']); |
|
156 | 156 | } |
157 | 157 | |
158 | 158 | protected function getOtherClauses(array $where, string $carry = null) : string |
@@ -186,6 +186,6 @@ discard block |
||
186 | 186 | return ''; |
187 | 187 | } |
188 | 188 | |
189 | - return '-' . implode('-', $eagerLoads->keys()->toArray()); |
|
189 | + return '-'.implode('-', $eagerLoads->keys()->toArray()); |
|
190 | 190 | } |
191 | 191 | } |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | |
13 | 13 | public function avg($column) |
14 | 14 | { |
15 | - if (! $this->isCachable) { |
|
15 | + if (!$this->isCachable) { |
|
16 | 16 | return parent::avg($column); |
17 | 17 | } |
18 | 18 | |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | |
26 | 26 | public function count($columns = ['*']) |
27 | 27 | { |
28 | - if (! $this->isCachable) { |
|
28 | + if (!$this->isCachable) { |
|
29 | 29 | return parent::count($columns); |
30 | 30 | } |
31 | 31 | |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | |
39 | 39 | public function cursor() |
40 | 40 | { |
41 | - if (! $this->isCachable) { |
|
41 | + if (!$this->isCachable) { |
|
42 | 42 | return collect(parent::cursor()); |
43 | 43 | } |
44 | 44 | |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | */ |
63 | 63 | public function find($id, $columns = ['*']) |
64 | 64 | { |
65 | - if (! $this->isCachable) { |
|
65 | + if (!$this->isCachable) { |
|
66 | 66 | return parent::find($id, $columns); |
67 | 67 | } |
68 | 68 | |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | |
76 | 76 | public function first($columns = ['*']) |
77 | 77 | { |
78 | - if (! $this->isCachable) { |
|
78 | + if (!$this->isCachable) { |
|
79 | 79 | return parent::first($columns); |
80 | 80 | } |
81 | 81 | |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | |
89 | 89 | public function get($columns = ['*']) |
90 | 90 | { |
91 | - if (! $this->isCachable) { |
|
91 | + if (!$this->isCachable) { |
|
92 | 92 | return parent::get($columns); |
93 | 93 | } |
94 | 94 | |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | |
102 | 102 | public function max($column) |
103 | 103 | { |
104 | - if (! $this->isCachable) { |
|
104 | + if (!$this->isCachable) { |
|
105 | 105 | return parent::max($column); |
106 | 106 | } |
107 | 107 | |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | |
115 | 115 | public function min($column) |
116 | 116 | { |
117 | - if (! $this->isCachable) { |
|
117 | + if (!$this->isCachable) { |
|
118 | 118 | return parent::min($column); |
119 | 119 | } |
120 | 120 | |
@@ -127,11 +127,11 @@ discard block |
||
127 | 127 | |
128 | 128 | public function pluck($column, $key = null) |
129 | 129 | { |
130 | - if (! $this->isCachable) { |
|
130 | + if (!$this->isCachable) { |
|
131 | 131 | return parent::pluck($column, $key); |
132 | 132 | } |
133 | 133 | |
134 | - $keyDifferentiator = "-pluck_{$column}" . ($key ? "_{$key}" : ""); |
|
134 | + $keyDifferentiator = "-pluck_{$column}".($key ? "_{$key}" : ""); |
|
135 | 135 | $arguments = func_get_args(); |
136 | 136 | $cacheKey = $this->makeCacheKey([$column], null, $keyDifferentiator); |
137 | 137 | $method = 'pluck'; |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | |
142 | 142 | public function sum($column) |
143 | 143 | { |
144 | - if (! $this->isCachable) { |
|
144 | + if (!$this->isCachable) { |
|
145 | 145 | return parent::sum($column); |
146 | 146 | } |
147 | 147 | |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | |
155 | 155 | public function value($column) |
156 | 156 | { |
157 | - if (! $this->isCachable) { |
|
157 | + if (!$this->isCachable) { |
|
158 | 158 | return parent::value($column); |
159 | 159 | } |
160 | 160 | |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | return $this->cache($cacheTags) |
204 | 204 | ->rememberForever( |
205 | 205 | $hashedCacheKey, |
206 | - function () use ($arguments, $cacheKey, $method) { |
|
206 | + function() use ($arguments, $cacheKey, $method) { |
|
207 | 207 | return [ |
208 | 208 | 'key' => $cacheKey, |
209 | 209 | 'value' => parent::{$method}(...$arguments), |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | { |
12 | 12 | $option = $this->option('model'); |
13 | 13 | |
14 | - if (! $option) { |
|
14 | + if (!$option) { |
|
15 | 15 | $this->error("You must specify a model to flush a model's cache:"); |
16 | 16 | $this->line("modelCache:flush --model=App\\Model"); |
17 | 17 | |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | $usesCachableTrait = collect(class_uses($model)) |
23 | 23 | ->contains("GeneaLabs\LaravelModelCaching\Traits\Cachable"); |
24 | 24 | |
25 | - if (! $usesCachableTrait) { |
|
25 | + if (!$usesCachableTrait) { |
|
26 | 26 | $this->error("'{$option}' is not an instance of CachedModel."); |
27 | 27 | $this->line("Only CachedModel instances can be flushed."); |
28 | 28 |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | $usesCachableTrait = collect(class_uses($this)) |
35 | 35 | ->contains("GeneaLabs\LaravelModelCaching\Traits\Cachable"); |
36 | 36 | |
37 | - if (! $usesCachableTrait) { |
|
37 | + if (!$usesCachableTrait) { |
|
38 | 38 | array_push($tags, str_slug(get_called_class())); |
39 | 39 | } |
40 | 40 | |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | |
83 | 83 | public static function bootCachable() |
84 | 84 | { |
85 | - static::saved(function ($instance) { |
|
85 | + static::saved(function($instance) { |
|
86 | 86 | $instance->flushCache(); |
87 | 87 | }); |
88 | 88 | } |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | $key = $instance->makeCacheKey(); |
100 | 100 | |
101 | 101 | return $instance->cache($tags) |
102 | - ->rememberForever($key, function () use ($columns) { |
|
102 | + ->rememberForever($key, function() use ($columns) { |
|
103 | 103 | return parent::all($columns); |
104 | 104 | }); |
105 | 105 | } |