@@ -12,7 +12,7 @@ |
||
12 | 12 | |
13 | 13 | (new Book) |
14 | 14 | ->get() |
15 | - ->each(function ($book) { |
|
15 | + ->each(function($book) { |
|
16 | 16 | $book->image()->create([ |
17 | 17 | "path" => app(Faker::class)->imageUrl(), |
18 | 18 | ]); |
@@ -11,13 +11,13 @@ |
||
11 | 11 | public function testWithQuery() |
12 | 12 | { |
13 | 13 | $books = (new Book) |
14 | - ->where(function ($query) { |
|
14 | + ->where(function($query) { |
|
15 | 15 | $query->where("id", ">", "1") |
16 | 16 | ->where("id", "<", "5"); |
17 | 17 | }) |
18 | 18 | ->get(); |
19 | 19 | $uncachedBooks = (new UncachedBook) |
20 | - ->where(function ($query) { |
|
20 | + ->where(function($query) { |
|
21 | 21 | $query->where("id", ">", "1") |
22 | 22 | ->where("id", "<", "5"); |
23 | 23 | }) |
@@ -15,7 +15,7 @@ |
||
15 | 15 | ->first(); |
16 | 16 | factory(Book::class, 1) |
17 | 17 | ->make() |
18 | - ->each(function ($book) use ($author1) { |
|
18 | + ->each(function($book) use ($author1) { |
|
19 | 19 | $publisher = (new Publisher)->first(); |
20 | 20 | $book->author()->associate($author1); |
21 | 21 | $book->publisher()->associate($publisher); |
@@ -54,13 +54,13 @@ |
||
54 | 54 | public function testWithMultipleMorphModelsWithClosure() |
55 | 55 | { |
56 | 56 | $comments = (new Comment) |
57 | - ->whereHasMorph('commentable', [Post::class, UncachedPost::class], function (Builder $query) { |
|
58 | - return $query->where('subject', 'like', '%uncached post'); |
|
57 | + ->whereHasMorph('commentable', [Post::class, UncachedPost::class], function(Builder $query) { |
|
58 | + return $query->where('subject', 'like', '%uncached post'); |
|
59 | 59 | }) |
60 | 60 | ->get(); |
61 | 61 | $uncachedComments = (new UncachedComment()) |
62 | - ->whereHasMorph('commentable', [Post::class, UncachedPost::class], function (Builder $query) { |
|
63 | - return $query->where('subject', 'like', '%uncached post'); |
|
62 | + ->whereHasMorph('commentable', [Post::class, UncachedPost::class], function(Builder $query) { |
|
63 | + return $query->where('subject', 'like', '%uncached post'); |
|
64 | 64 | }) |
65 | 65 | ->get(); |
66 | 66 |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | { |
111 | 111 | $books = (new Book) |
112 | 112 | ->with('author') |
113 | - ->whereHas('author', function ($query) { |
|
113 | + ->whereHas('author', function($query) { |
|
114 | 114 | $query->whereId('1'); |
115 | 115 | }) |
116 | 116 | ->get(); |
@@ -134,14 +134,14 @@ discard block |
||
134 | 134 | { |
135 | 135 | $books1 = (new Book) |
136 | 136 | ->with('author') |
137 | - ->whereHas('author', function ($query) { |
|
137 | + ->whereHas('author', function($query) { |
|
138 | 138 | $query->whereId(1); |
139 | 139 | }) |
140 | 140 | ->get() |
141 | 141 | ->keyBy('id'); |
142 | 142 | $books2 = (new Book) |
143 | 143 | ->with('author') |
144 | - ->whereHas('author', function ($query) { |
|
144 | + ->whereHas('author', function($query) { |
|
145 | 145 | $query->whereId(2); |
146 | 146 | }) |
147 | 147 | ->get() |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | |
51 | 51 | $authors = (new Author)->with('books', 'profile') |
52 | 52 | ->disableCache() |
53 | - ->chunk($chunkSize, function ($chunk) use (&$cachedChunks, $chunkSize) { |
|
53 | + ->chunk($chunkSize, function($chunk) use (&$cachedChunks, $chunkSize) { |
|
54 | 54 | $offset = ''; |
55 | 55 | |
56 | 56 | if ($cachedChunks['authors']->count()) { |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | }); |
66 | 66 | |
67 | 67 | $liveResults = (new UncachedAuthor)->with('books', 'profile') |
68 | - ->chunk($chunkSize, function ($chunk) use (&$uncachedChunks) { |
|
68 | + ->chunk($chunkSize, function($chunk) use (&$uncachedChunks) { |
|
69 | 69 | $uncachedChunks->push($chunk); |
70 | 70 | }); |
71 | 71 |
@@ -19,7 +19,7 @@ |
||
19 | 19 | /** @var Collection $publishers */ |
20 | 20 | $publishers = factory(UncachedPublisher::class, 5)->create(); |
21 | 21 | |
22 | - $publishers->each(function (UncachedPublisher $publisher) { |
|
22 | + $publishers->each(function(UncachedPublisher $publisher) { |
|
23 | 23 | factory(UncachedBook::class, 2)->create(['publisher_id' => $publisher->id]); |
24 | 24 | }); |
25 | 25 |
@@ -88,15 +88,15 @@ |
||
88 | 88 | } |
89 | 89 | |
90 | 90 | public function testPaginationUrlIsCorrect() { |
91 | - $this->baseUrl = 'https://test.local'; |
|
91 | + $this->baseUrl = 'https://test.local'; |
|
92 | 92 | |
93 | - $this->visit("pagination-test2?custom-page=2") |
|
94 | - ->see('https://test.local/pagination-test2?custom-page=1'); |
|
93 | + $this->visit("pagination-test2?custom-page=2") |
|
94 | + ->see('https://test.local/pagination-test2?custom-page=1'); |
|
95 | 95 | |
96 | - $this->baseUrl = 'https://changed.local'; |
|
96 | + $this->baseUrl = 'https://changed.local'; |
|
97 | 97 | |
98 | - $this->visit("pagination-test2?custom-page=2") |
|
99 | - ->see('https://changed.local/pagination-test2?custom-page=1'); |
|
98 | + $this->visit("pagination-test2?custom-page=2") |
|
99 | + ->see('https://changed.local/pagination-test2?custom-page=1'); |
|
100 | 100 | |
101 | 101 | } |
102 | 102 | } |
@@ -367,6 +367,6 @@ |
||
367 | 367 | |
368 | 368 | protected function getPathSlug() : string |
369 | 369 | { |
370 | - return ':' . strtolower(URL::to('/')); |
|
370 | + return ':' . strtolower(URL::to('/')); |
|
371 | 371 | } |
372 | 372 | } |
@@ -60,8 +60,8 @@ discard block |
||
60 | 60 | |
61 | 61 | protected function getLimitClause() : string |
62 | 62 | { |
63 | - if (! property_exists($this->query, "limit") |
|
64 | - || ! $this->query->limit |
|
63 | + if (!property_exists($this->query, "limit") |
|
64 | + || !$this->query->limit |
|
65 | 65 | ) { |
66 | 66 | return ""; |
67 | 67 | } |
@@ -82,8 +82,8 @@ discard block |
||
82 | 82 | |
83 | 83 | protected function getOffsetClause() : string |
84 | 84 | { |
85 | - if (! property_exists($this->query, "offset") |
|
86 | - || ! $this->query->offset |
|
85 | + if (!property_exists($this->query, "offset") |
|
86 | + || !$this->query->offset |
|
87 | 87 | ) { |
88 | 88 | return ""; |
89 | 89 | } |
@@ -93,8 +93,8 @@ discard block |
||
93 | 93 | |
94 | 94 | protected function getOrderByClauses() : string |
95 | 95 | { |
96 | - if (! property_exists($this->query, "orders") |
|
97 | - || ! $this->query->orders |
|
96 | + if (!property_exists($this->query, "orders") |
|
97 | + || !$this->query->orders |
|
98 | 98 | ) { |
99 | 99 | return ""; |
100 | 100 | } |
@@ -102,12 +102,12 @@ discard block |
||
102 | 102 | $orders = collect($this->query->orders); |
103 | 103 | |
104 | 104 | return $orders |
105 | - ->reduce(function ($carry, $order) { |
|
105 | + ->reduce(function($carry, $order) { |
|
106 | 106 | if (($order["type"] ?? "") === "Raw") { |
107 | - return $carry . "_orderByRaw_" . (new Str)->slug($order["sql"]); |
|
107 | + return $carry."_orderByRaw_".(new Str)->slug($order["sql"]); |
|
108 | 108 | } |
109 | 109 | |
110 | - return $carry . "_orderBy_" . $order["column"] . "_" . $order["direction"]; |
|
110 | + return $carry."_orderBy_".$order["column"]."_".$order["direction"]; |
|
111 | 111 | }) |
112 | 112 | ?: ""; |
113 | 113 | } |
@@ -116,8 +116,8 @@ discard block |
||
116 | 116 | { |
117 | 117 | if (($columns === ["*"] |
118 | 118 | || $columns === []) |
119 | - && (! property_exists($this->query, "columns") |
|
120 | - || ! $this->query->columns) |
|
119 | + && (!property_exists($this->query, "columns") |
|
120 | + || !$this->query->columns) |
|
121 | 121 | ) { |
122 | 122 | return ""; |
123 | 123 | } |
@@ -125,10 +125,10 @@ discard block |
||
125 | 125 | if (property_exists($this->query, "columns") |
126 | 126 | && $this->query->columns |
127 | 127 | ) { |
128 | - return "_" . implode("_", $this->query->columns); |
|
128 | + return "_".implode("_", $this->query->columns); |
|
129 | 129 | } |
130 | 130 | |
131 | - return "_" . implode("_", $columns); |
|
131 | + return "_".implode("_", $columns); |
|
132 | 132 | } |
133 | 133 | |
134 | 134 | protected function getTypeClause($where) : string |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | |
143 | 143 | protected function getValuesClause(array $where = []) : string |
144 | 144 | { |
145 | - if (! $where |
|
145 | + if (!$where |
|
146 | 146 | || in_array($where["type"], ["NotNull", "Null"]) |
147 | 147 | ) { |
148 | 148 | return ""; |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | $values = $this->getValuesFromWhere($where); |
152 | 152 | $values = $this->getValuesFromBindings($where, $values); |
153 | 153 | |
154 | - return "_" . $values; |
|
154 | + return "_".$values; |
|
155 | 155 | } |
156 | 156 | |
157 | 157 | protected function getValuesFromWhere(array $where) : string |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | $this->currentBinding++; |
182 | 182 | |
183 | 183 | if ($where["type"] === "between") { |
184 | - $values .= "_" . $this->query->bindings["where"][$this->currentBinding]; |
|
184 | + $values .= "_".$this->query->bindings["where"][$this->currentBinding]; |
|
185 | 185 | $this->currentBinding++; |
186 | 186 | } |
187 | 187 | } |
@@ -197,8 +197,8 @@ discard block |
||
197 | 197 | |
198 | 198 | protected function getWhereClauses(array $wheres = []) : string |
199 | 199 | { |
200 | - return "" . $this->getWheres($wheres) |
|
201 | - ->reduce(function ($carry, $where) { |
|
200 | + return "".$this->getWheres($wheres) |
|
201 | + ->reduce(function($carry, $where) { |
|
202 | 202 | $value = $carry; |
203 | 203 | $value .= $this->getNestedClauses($where); |
204 | 204 | $value .= $this->getColumnClauses($where); |
@@ -212,11 +212,11 @@ discard block |
||
212 | 212 | |
213 | 213 | protected function getNestedClauses(array $where) : string |
214 | 214 | { |
215 | - if (! in_array($where["type"], ["Exists", "Nested", "NotExists"])) { |
|
215 | + if (!in_array($where["type"], ["Exists", "Nested", "NotExists"])) { |
|
216 | 216 | return ""; |
217 | 217 | } |
218 | 218 | |
219 | - return "-" . strtolower($where["type"]) . $this->getWhereClauses($where["query"]->wheres); |
|
219 | + return "-".strtolower($where["type"]).$this->getWhereClauses($where["query"]->wheres); |
|
220 | 220 | } |
221 | 221 | |
222 | 222 | protected function getColumnClauses(array $where) : string |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | |
231 | 231 | protected function getInAndNotInClauses(array $where) : string |
232 | 232 | { |
233 | - if (! in_array($where["type"], ["In", "NotIn", "InRaw"])) { |
|
233 | + if (!in_array($where["type"], ["In", "NotIn", "InRaw"])) { |
|
234 | 234 | return ""; |
235 | 235 | } |
236 | 236 | |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | $this->currentBinding += count($where["values"]); |
243 | 243 | } |
244 | 244 | |
245 | - if (! is_numeric($subquery) && ! is_numeric(str_replace("_", "", $subquery))) { |
|
245 | + if (!is_numeric($subquery) && !is_numeric(str_replace("_", "", $subquery))) { |
|
246 | 246 | try { |
247 | 247 | $subquery = Uuid::fromBytes($subquery); |
248 | 248 | $values = $this->recursiveImplode([$subquery], "_"); |
@@ -280,7 +280,7 @@ discard block |
||
280 | 280 | continue; |
281 | 281 | } |
282 | 282 | |
283 | - $result .= $glue . $value; |
|
283 | + $result .= $glue.$value; |
|
284 | 284 | } |
285 | 285 | |
286 | 286 | return $result; |
@@ -288,7 +288,7 @@ discard block |
||
288 | 288 | |
289 | 289 | protected function getRawClauses(array $where) : string |
290 | 290 | { |
291 | - if (! in_array($where["type"], ["raw"])) { |
|
291 | + if (!in_array($where["type"], ["raw"])) { |
|
292 | 292 | return ""; |
293 | 293 | } |
294 | 294 | |
@@ -296,7 +296,7 @@ discard block |
||
296 | 296 | $clause = "_{$where["boolean"]}"; |
297 | 297 | |
298 | 298 | while (count($queryParts) > 1) { |
299 | - $clause .= "_" . array_shift($queryParts); |
|
299 | + $clause .= "_".array_shift($queryParts); |
|
300 | 300 | $clause .= $this->query->bindings["where"][$this->currentBinding]; |
301 | 301 | $this->currentBinding++; |
302 | 302 | } |
@@ -304,10 +304,10 @@ discard block |
||
304 | 304 | $lastPart = array_shift($queryParts); |
305 | 305 | |
306 | 306 | if ($lastPart) { |
307 | - $clause .= "_" . $lastPart; |
|
307 | + $clause .= "_".$lastPart; |
|
308 | 308 | } |
309 | 309 | |
310 | - return "-" . str_replace(" ", "_", $clause); |
|
310 | + return "-".str_replace(" ", "_", $clause); |
|
311 | 311 | } |
312 | 312 | |
313 | 313 | protected function getOtherClauses(array $where) : string |
@@ -343,8 +343,8 @@ discard block |
||
343 | 343 | return ""; |
344 | 344 | } |
345 | 345 | |
346 | - return $eagerLoads->keys()->reduce(function ($carry, $related) { |
|
347 | - if (! method_exists($this->model, $related)) { |
|
346 | + return $eagerLoads->keys()->reduce(function($carry, $related) { |
|
347 | + if (!method_exists($this->model, $related)) { |
|
348 | 348 | return "{$carry}-{$related}"; |
349 | 349 | } |
350 | 350 | |
@@ -358,7 +358,7 @@ discard block |
||
358 | 358 | |
359 | 359 | protected function getBindingsSlug() : string |
360 | 360 | { |
361 | - if (! method_exists($this->model, 'query')) { |
|
361 | + if (!method_exists($this->model, 'query')) { |
|
362 | 362 | return ''; |
363 | 363 | } |
364 | 364 | |
@@ -367,6 +367,6 @@ discard block |
||
367 | 367 | |
368 | 368 | protected function getPathSlug() : string |
369 | 369 | { |
370 | - return ':' . strtolower(URL::to('/')); |
|
370 | + return ':'.strtolower(URL::to('/')); |
|
371 | 371 | } |
372 | 372 | } |