@@ -77,7 +77,7 @@ |
||
| 77 | 77 | |
| 78 | 78 | if ($throughParent instanceof Pivot) { |
| 79 | 79 | if (isset($segments[1])) { |
| 80 | - $class = $throughParent::class . " as $segments[1]"; |
|
| 80 | + $class = $throughParent::class." as $segments[1]"; |
|
| 81 | 81 | } else { |
| 82 | 82 | $class = $table; |
| 83 | 83 | } |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | protected function addEagerConstraintsWithCompositeKey(array $models): void |
| 47 | 47 | { |
| 48 | 48 | $keys = collect($models)->map( |
| 49 | - function (Model $model) { |
|
| 49 | + function(Model $model) { |
|
| 50 | 50 | return array_map( |
| 51 | 51 | fn (string $column) => $model[$column], |
| 52 | 52 | $this->localKeys[0]->columns |
@@ -55,10 +55,10 @@ discard block |
||
| 55 | 55 | )->values()->unique(null, true)->all(); |
| 56 | 56 | |
| 57 | 57 | $this->query->where( |
| 58 | - function (Builder $query) use ($models, $keys) { |
|
| 58 | + function(Builder $query) use ($models, $keys) { |
|
| 59 | 59 | foreach ($keys as $key) { |
| 60 | 60 | $query->orWhere( |
| 61 | - function (Builder $query) use ($key) { |
|
| 61 | + function(Builder $query) use ($key) { |
|
| 62 | 62 | foreach ($this->foreignKeys[0]->columns as $i => $column) { |
| 63 | 63 | $query->where( |
| 64 | 64 | $this->throughParent->qualifyColumn($column), |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | $values = []; |
| 122 | 122 | |
| 123 | 123 | foreach ($this->foreignKeys[0]->columns as $i => $column) { |
| 124 | - $alias = 'laravel_through_key' . ($i > 0 ? "_$i" : ''); |
|
| 124 | + $alias = 'laravel_through_key'.($i > 0 ? "_$i" : ''); |
|
| 125 | 125 | |
| 126 | 126 | $values[] = $result->$alias; |
| 127 | 127 | } |
@@ -144,7 +144,7 @@ discard block |
||
| 144 | 144 | $columns = array_slice($this->foreignKeys[0]->columns, 1, null, true); |
| 145 | 145 | |
| 146 | 146 | return array_map( |
| 147 | - fn ($column, $i) => $this->throughParent->qualifyColumn($column) . " as laravel_through_key_$i", |
|
| 147 | + fn ($column, $i) => $this->throughParent->qualifyColumn($column)." as laravel_through_key_$i", |
|
| 148 | 148 | $columns, |
| 149 | 149 | array_keys($columns) |
| 150 | 150 | ); |
@@ -78,7 +78,7 @@ |
||
| 78 | 78 | */ |
| 79 | 79 | protected function hasOneOrManyDeepThroughParents(array $through) |
| 80 | 80 | { |
| 81 | - return array_map(function ($class) { |
|
| 81 | + return array_map(function($class) { |
|
| 82 | 82 | $segments = preg_split('/\s+(as|from)\s+/i', $class, -1, PREG_SPLIT_DELIM_CAPTURE); |
| 83 | 83 | |
| 84 | 84 | $instance = $this->newRelatedDeepThroughInstance($segments[0]); |
@@ -238,7 +238,7 @@ discard block |
||
| 238 | 238 | |
| 239 | 239 | $this->query->addSelect($columns); |
| 240 | 240 | |
| 241 | - return tap($this->query->paginate($perPage, $columns, $pageName, $page), function (Paginator $paginator) { |
|
| 241 | + return tap($this->query->paginate($perPage, $columns, $pageName, $page), function(Paginator $paginator) { |
|
| 242 | 242 | $this->hydrateIntermediateRelations($paginator->items()); |
| 243 | 243 | }); |
| 244 | 244 | } |
@@ -261,7 +261,7 @@ discard block |
||
| 261 | 261 | |
| 262 | 262 | $this->query->addSelect($columns); |
| 263 | 263 | |
| 264 | - return tap($this->query->simplePaginate($perPage, $columns, $pageName, $page), function (Paginator $paginator) { |
|
| 264 | + return tap($this->query->simplePaginate($perPage, $columns, $pageName, $page), function(Paginator $paginator) { |
|
| 265 | 265 | $this->hydrateIntermediateRelations($paginator->items()); |
| 266 | 266 | }); |
| 267 | 267 | } |
@@ -284,7 +284,7 @@ discard block |
||
| 284 | 284 | |
| 285 | 285 | $this->query->addSelect($columns); |
| 286 | 286 | |
| 287 | - return tap($this->query->cursorPaginate($perPage, $columns, $cursorName, $cursor), function (CursorPaginator $paginator) { |
|
| 287 | + return tap($this->query->cursorPaginate($perPage, $columns, $cursorName, $cursor), function(CursorPaginator $paginator) { |
|
| 288 | 288 | $this->hydrateIntermediateRelations($paginator->items()); |
| 289 | 289 | }); |
| 290 | 290 | } |
@@ -306,7 +306,7 @@ discard block |
||
| 306 | 306 | if ($this->customThroughKeyCallback) { |
| 307 | 307 | $columns[] = ($this->customThroughKeyCallback)($alias); |
| 308 | 308 | } else { |
| 309 | - $columns[] = $this->getQualifiedFirstKeyName() . " as $alias"; |
|
| 309 | + $columns[] = $this->getQualifiedFirstKeyName()." as $alias"; |
|
| 310 | 310 | } |
| 311 | 311 | |
| 312 | 312 | if ($this->hasLeadingCompositeKey()) { |
@@ -328,7 +328,7 @@ discard block |
||
| 328 | 328 | */ |
| 329 | 329 | public function chunk($count, callable $callback) |
| 330 | 330 | { |
| 331 | - return $this->prepareQueryBuilder()->chunk($count, function (Collection $results) use ($callback) { |
|
| 331 | + return $this->prepareQueryBuilder()->chunk($count, function(Collection $results) use ($callback) { |
|
| 332 | 332 | $this->hydrateIntermediateRelations($results->all()); |
| 333 | 333 | |
| 334 | 334 | return $callback($results); |
@@ -359,7 +359,7 @@ discard block |
||
| 359 | 359 | ); |
| 360 | 360 | } |
| 361 | 361 | |
| 362 | - $table = $throughParent->getTable() . ' as ' . $this->getRelationCountHash(); |
|
| 362 | + $table = $throughParent->getTable().' as '.$this->getRelationCountHash(); |
|
| 363 | 363 | |
| 364 | 364 | $throughParent->setTable($table); |
| 365 | 365 | |
@@ -434,7 +434,7 @@ discard block |
||
| 434 | 434 | } |
| 435 | 435 | |
| 436 | 436 | foreach ($columns as $column) { |
| 437 | - $this->query->withoutGlobalScope(__CLASS__ . ":$column"); |
|
| 437 | + $this->query->withoutGlobalScope(__CLASS__.":$column"); |
|
| 438 | 438 | } |
| 439 | 439 | |
| 440 | 440 | return $this; |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | $related = get_class($relation->getRelated()); |
| 141 | 141 | |
| 142 | 142 | if ((new $related())->getTable() !== $relation->getRelated()->getTable()) { |
| 143 | - $related .= ' from ' . $relation->getRelated()->getTable(); |
|
| 143 | + $related .= ' from '.$relation->getRelated()->getTable(); |
|
| 144 | 144 | } |
| 145 | 145 | } else { |
| 146 | 146 | $through[] = $this->hasOneOrManyThroughParent($relation, $relations[$i + 1]); |
@@ -177,11 +177,11 @@ discard block |
||
| 177 | 177 | if (is_array($relation->getOwnerKeyName())) { |
| 178 | 178 | // https://github.com/topclaudy/compoships |
| 179 | 179 | $foreignKeys[] = new CompositeKey( |
| 180 | - ...(array)$relation->getOwnerKeyName() |
|
| 180 | + ...(array) $relation->getOwnerKeyName() |
|
| 181 | 181 | ); |
| 182 | 182 | |
| 183 | 183 | $localKeys[] = new CompositeKey( |
| 184 | - ...(array)$relation->getForeignKeyName() |
|
| 184 | + ...(array) $relation->getForeignKeyName() |
|
| 185 | 185 | ); |
| 186 | 186 | } else { |
| 187 | 187 | $foreignKeys[] = $relation->getOwnerKeyName(); |
@@ -236,11 +236,11 @@ discard block |
||
| 236 | 236 | if (is_array($relation->getForeignKeyName())) { |
| 237 | 237 | // https://github.com/topclaudy/compoships |
| 238 | 238 | $foreignKeys[] = new CompositeKey( |
| 239 | - ...(array)$relation->getForeignKeyName() |
|
| 239 | + ...(array) $relation->getForeignKeyName() |
|
| 240 | 240 | ); |
| 241 | 241 | |
| 242 | 242 | $localKeys[] = new CompositeKey( |
| 243 | - ...(array)$relation->getLocalKeyName() |
|
| 243 | + ...(array) $relation->getLocalKeyName() |
|
| 244 | 244 | ); |
| 245 | 245 | } else { |
| 246 | 246 | $foreignKeys[] = $relation->getForeignKeyName(); |
@@ -352,7 +352,7 @@ discard block |
||
| 352 | 352 | |
| 353 | 353 | foreach ($classes as $class) { |
| 354 | 354 | if ($relation instanceof $class) { |
| 355 | - return 'hasOneOrManyDeepFrom' . class_basename($class); |
|
| 355 | + return 'hasOneOrManyDeepFrom'.class_basename($class); |
|
| 356 | 356 | } |
| 357 | 357 | } |
| 358 | 358 | |
@@ -371,11 +371,11 @@ discard block |
||
| 371 | 371 | $through = get_class($relation->getRelated()); |
| 372 | 372 | |
| 373 | 373 | if ($relation instanceof ConcatenableRelation && method_exists($relation, 'getTableForDeepRelationship')) { |
| 374 | - return $through . ' from ' . $relation->getTableForDeepRelationship(); |
|
| 374 | + return $through.' from '.$relation->getTableForDeepRelationship(); |
|
| 375 | 375 | } |
| 376 | 376 | |
| 377 | 377 | if ((new $through())->getTable() !== $relation->getRelated()->getTable()) { |
| 378 | - $through .= ' from ' . $relation->getRelated()->getTable(); |
|
| 378 | + $through .= ' from '.$relation->getRelated()->getTable(); |
|
| 379 | 379 | } |
| 380 | 380 | |
| 381 | 381 | if (get_class($relation->getRelated()) === get_class($successor->getParent())) { |
@@ -384,7 +384,7 @@ discard block |
||
| 384 | 384 | $segments = explode(' as ', $table); |
| 385 | 385 | |
| 386 | 386 | if (isset($segments[1])) { |
| 387 | - $through .= ' as ' . $segments[1]; |
|
| 387 | + $through .= ' as '.$segments[1]; |
|
| 388 | 388 | } |
| 389 | 389 | } |
| 390 | 390 | |
@@ -407,7 +407,7 @@ discard block |
||
| 407 | 407 | ?callable $customThroughKeyCallback, |
| 408 | 408 | ?callable $customEagerConstraintsCallback, |
| 409 | 409 | ?callable $customEagerMatchingCallback |
| 410 | - ): HasManyDeep|HasOneDeep { |
|
| 410 | + ): HasManyDeep | HasOneDeep { |
|
| 411 | 411 | $relation->withPostGetCallbacks($postGetCallbacks); |
| 412 | 412 | |
| 413 | 413 | if ($customThroughKeyCallback) { |
@@ -461,11 +461,11 @@ discard block |
||
| 461 | 461 | protected function addConstraintsToHasOneOrManyDeepRelationship( |
| 462 | 462 | HasManyDeep $deepRelation, |
| 463 | 463 | array $relations |
| 464 | - ): HasManyDeep|HasOneDeep { |
|
| 464 | + ): HasManyDeep | HasOneDeep { |
|
| 465 | 465 | $relations = $this->normalizeVariadicRelations($relations); |
| 466 | 466 | |
| 467 | 467 | foreach ($relations as $i => $relation) { |
| 468 | - $relationWithoutConstraints = Relation::noConstraints(function () use ($relation) { |
|
| 468 | + $relationWithoutConstraints = Relation::noConstraints(function() use ($relation) { |
|
| 469 | 469 | return $relation(); |
| 470 | 470 | }); |
| 471 | 471 | |
@@ -514,7 +514,7 @@ discard block |
||
| 514 | 514 | $deepRelation->withTrashed($deletedAtColumn); |
| 515 | 515 | } |
| 516 | 516 | |
| 517 | - if (str_starts_with($scope, HasManyDeep::class . ':')) { |
|
| 517 | + if (str_starts_with($scope, HasManyDeep::class.':')) { |
|
| 518 | 518 | $deletedAtColumn = explode(':', $scope)[1]; |
| 519 | 519 | |
| 520 | 520 | $deepRelation->withTrashed($deletedAtColumn); |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | |
| 44 | 44 | $query->join( |
| 45 | 45 | $table, |
| 46 | - function (JoinClause $join) use ($joins) { |
|
| 46 | + function(JoinClause $join) use ($joins) { |
|
| 47 | 47 | foreach ($joins as [$first, $second]) { |
| 48 | 48 | $join->on($first, '=', $second); |
| 49 | 49 | } |
@@ -52,9 +52,9 @@ discard block |
||
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | if ($this->throughParentInstanceSoftDeletes($throughParent)) { |
| 55 | - $column= $throughParent->getQualifiedDeletedAtColumn(); |
|
| 55 | + $column = $throughParent->getQualifiedDeletedAtColumn(); |
|
| 56 | 56 | |
| 57 | - $query->withGlobalScope(__CLASS__ . ":$column", function (Builder $query) use ($column) { |
|
| 57 | + $query->withGlobalScope(__CLASS__.":$column", function(Builder $query) use ($column) { |
|
| 58 | 58 | $query->whereNull($column); |
| 59 | 59 | }); |
| 60 | 60 | } |