@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | |
54 | 54 | protected function getLimitClause() : string |
55 | 55 | { |
56 | - if (! $this->query->limit) { |
|
56 | + if (!$this->query->limit) { |
|
57 | 57 | return ""; |
58 | 58 | } |
59 | 59 | |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | |
74 | 74 | protected function getOffsetClause() : string |
75 | 75 | { |
76 | - if (! $this->query->offset) { |
|
76 | + if (!$this->query->offset) { |
|
77 | 77 | return ""; |
78 | 78 | } |
79 | 79 | |
@@ -85,12 +85,12 @@ discard block |
||
85 | 85 | $orders = collect($this->query->orders); |
86 | 86 | |
87 | 87 | return $orders |
88 | - ->reduce(function ($carry, $order) { |
|
88 | + ->reduce(function($carry, $order) { |
|
89 | 89 | if (($order["type"] ?? "") === "Raw") { |
90 | - return $carry . "_orderByRaw_" . str_slug($order["sql"]); |
|
90 | + return $carry."_orderByRaw_".str_slug($order["sql"]); |
|
91 | 91 | } |
92 | 92 | |
93 | - return $carry . "_orderBy_" . $order["column"] . "_" . $order["direction"]; |
|
93 | + return $carry."_orderBy_".$order["column"]."_".$order["direction"]; |
|
94 | 94 | }) |
95 | 95 | ?: ""; |
96 | 96 | } |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | return ""; |
102 | 102 | } |
103 | 103 | |
104 | - return "_" . implode("_", $columns); |
|
104 | + return "_".implode("_", $columns); |
|
105 | 105 | } |
106 | 106 | |
107 | 107 | protected function getTypeClause($where) : string |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | $values = $this->getValuesFromWhere($where); |
123 | 123 | $values = $this->getValuesFromBindings($where, $values); |
124 | 124 | |
125 | - return "_" . $values; |
|
125 | + return "_".$values; |
|
126 | 126 | } |
127 | 127 | |
128 | 128 | protected function getValuesFromWhere(array $where) : string |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | $subKey = str_replace($prefix, "", $subKey); |
135 | 135 | $subKey = str_replace($this->getModelSlug(), "", $subKey); |
136 | 136 | $classParts = explode("\\", get_class($this->model)); |
137 | - $subKey = strtolower(array_pop($classParts)) . $subKey; |
|
137 | + $subKey = strtolower(array_pop($classParts)).$subKey; |
|
138 | 138 | |
139 | 139 | return $subKey; |
140 | 140 | } |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | $this->currentBinding++; |
155 | 155 | |
156 | 156 | if ($where["type"] === "between") { |
157 | - $values .= "_" . $this->query->bindings["where"][$this->currentBinding]; |
|
157 | + $values .= "_".$this->query->bindings["where"][$this->currentBinding]; |
|
158 | 158 | $this->currentBinding++; |
159 | 159 | } |
160 | 160 | } |
@@ -164,8 +164,8 @@ discard block |
||
164 | 164 | |
165 | 165 | protected function getWhereClauses(array $wheres = []) : string |
166 | 166 | { |
167 | - return "" . $this->getWheres($wheres) |
|
168 | - ->reduce(function ($carry, $where) { |
|
167 | + return "".$this->getWheres($wheres) |
|
168 | + ->reduce(function($carry, $where) { |
|
169 | 169 | $value = $carry; |
170 | 170 | $value .= $this->getNestedClauses($where); |
171 | 171 | $value .= $this->getColumnClauses($where); |
@@ -179,11 +179,11 @@ discard block |
||
179 | 179 | |
180 | 180 | protected function getNestedClauses(array $where) : string |
181 | 181 | { |
182 | - if (! in_array($where["type"], ["Exists", "Nested", "NotExists"])) { |
|
182 | + if (!in_array($where["type"], ["Exists", "Nested", "NotExists"])) { |
|
183 | 183 | return ""; |
184 | 184 | } |
185 | 185 | |
186 | - return "-" . strtolower($where["type"]) . $this->getWhereClauses($where["query"]->wheres); |
|
186 | + return "-".strtolower($where["type"]).$this->getWhereClauses($where["query"]->wheres); |
|
187 | 187 | } |
188 | 188 | |
189 | 189 | protected function getColumnClauses(array $where) : string |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | |
198 | 198 | protected function getInClauses(array $where) : string |
199 | 199 | { |
200 | - if (! in_array($where["type"], ["In"])) { |
|
200 | + if (!in_array($where["type"], ["In"])) { |
|
201 | 201 | return ""; |
202 | 202 | } |
203 | 203 | |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | |
210 | 210 | protected function getInAndNotInClauses(array $where) : string |
211 | 211 | { |
212 | - if (! in_array($where["type"], ["In", "NotIn"])) { |
|
212 | + if (!in_array($where["type"], ["In", "NotIn"])) { |
|
213 | 213 | return ""; |
214 | 214 | } |
215 | 215 | |
@@ -247,7 +247,7 @@ discard block |
||
247 | 247 | continue; |
248 | 248 | } |
249 | 249 | |
250 | - $result .= $glue . $value; |
|
250 | + $result .= $glue.$value; |
|
251 | 251 | } |
252 | 252 | |
253 | 253 | return $result; |
@@ -263,7 +263,7 @@ discard block |
||
263 | 263 | $clause = "_{$where["boolean"]}"; |
264 | 264 | |
265 | 265 | while (count($queryParts) > 1) { |
266 | - $clause .= "_" . array_shift($queryParts); |
|
266 | + $clause .= "_".array_shift($queryParts); |
|
267 | 267 | $clause .= $this->query->bindings["where"][$this->currentBinding]; |
268 | 268 | $this->currentBinding++; |
269 | 269 | } |
@@ -271,10 +271,10 @@ discard block |
||
271 | 271 | $lastPart = array_shift($queryParts); |
272 | 272 | |
273 | 273 | if ($lastPart) { |
274 | - $clause .= "_" . $lastPart; |
|
274 | + $clause .= "_".$lastPart; |
|
275 | 275 | } |
276 | 276 | |
277 | - return "-" . str_replace(" ", "_", $clause); |
|
277 | + return "-".str_replace(" ", "_", $clause); |
|
278 | 278 | } |
279 | 279 | |
280 | 280 | protected function getOtherClauses(array $where) : string |
@@ -308,8 +308,8 @@ discard block |
||
308 | 308 | return ""; |
309 | 309 | } |
310 | 310 | |
311 | - return $eagerLoads->keys()->reduce(function ($carry, $related) { |
|
312 | - if (! method_exists($this->model, $related)) { |
|
311 | + return $eagerLoads->keys()->reduce(function($carry, $related) { |
|
312 | + if (!method_exists($this->model, $related)) { |
|
313 | 313 | return "{$carry}-{$related}"; |
314 | 314 | } |
315 | 315 |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | { |
29 | 29 | $tags = collect($this->eagerLoad) |
30 | 30 | ->keys() |
31 | - ->map(function ($relationName) { |
|
31 | + ->map(function($relationName) { |
|
32 | 32 | $relation = $this->getRelation($relationName); |
33 | 33 | |
34 | 34 | return $this->getCachePrefix() |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | protected function getRelation(string $relationName) : Relation |
54 | 54 | { |
55 | 55 | return collect(explode('.', $relationName)) |
56 | - ->reduce(function ($carry, $name) { |
|
56 | + ->reduce(function($carry, $name) { |
|
57 | 57 | $carry = $carry ?: $this->model; |
58 | 58 | $carry = $this->getRelatedModel($carry); |
59 | 59 |
@@ -5,10 +5,10 @@ |
||
5 | 5 | protected function getCachePrefix() : string |
6 | 6 | { |
7 | 7 | return "genealabs:laravel-model-caching:" |
8 | - . $this->getConnectionName() . ":" |
|
9 | - . $this->getDatabaseName() . ":" |
|
8 | + . $this->getConnectionName().":" |
|
9 | + . $this->getDatabaseName().":" |
|
10 | 10 | . (config("laravel-model-caching.cache-prefix") |
11 | - ? config("laravel-model-caching.cache-prefix", "") . ":" |
|
11 | + ? config("laravel-model-caching.cache-prefix", "").":" |
|
12 | 12 | : ""); |
13 | 13 | } |
14 | 14 |