@@ -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]); |
@@ -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 | } |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | |
| 61 | 61 | $this->query->addSelect($columns); |
| 62 | 62 | |
| 63 | - return tap($this->query->paginate($perPage, $columns, $pageName, $page), function (Paginator $paginator) { |
|
| 63 | + return tap($this->query->paginate($perPage, $columns, $pageName, $page), function(Paginator $paginator) { |
|
| 64 | 64 | $this->hydrateIntermediateRelations($paginator->items()); |
| 65 | 65 | }); |
| 66 | 66 | } |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | |
| 84 | 84 | $this->query->addSelect($columns); |
| 85 | 85 | |
| 86 | - return tap($this->query->simplePaginate($perPage, $columns, $pageName, $page), function (Paginator $paginator) { |
|
| 86 | + return tap($this->query->simplePaginate($perPage, $columns, $pageName, $page), function(Paginator $paginator) { |
|
| 87 | 87 | $this->hydrateIntermediateRelations($paginator->items()); |
| 88 | 88 | }); |
| 89 | 89 | } |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | |
| 107 | 107 | $this->query->addSelect($columns); |
| 108 | 108 | |
| 109 | - return tap($this->query->cursorPaginate($perPage, $columns, $cursorName, $cursor), function (CursorPaginator $paginator) { |
|
| 109 | + return tap($this->query->cursorPaginate($perPage, $columns, $cursorName, $cursor), function(CursorPaginator $paginator) { |
|
| 110 | 110 | $this->hydrateIntermediateRelations($paginator->items()); |
| 111 | 111 | }); |
| 112 | 112 | } |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | */ |
| 121 | 121 | public function chunk($count, callable $callback) |
| 122 | 122 | { |
| 123 | - return $this->prepareQueryBuilder()->chunk($count, function (Collection $results) use ($callback) { |
|
| 123 | + return $this->prepareQueryBuilder()->chunk($count, function(Collection $results) use ($callback) { |
|
| 124 | 124 | $this->hydrateIntermediateRelations($results->all()); |
| 125 | 125 | |
| 126 | 126 | return $callback($results); |
@@ -32,11 +32,11 @@ discard block |
||
| 32 | 32 | if (is_array($relation->getOwnerKeyName())) { |
| 33 | 33 | // https://github.com/topclaudy/compoships |
| 34 | 34 | $foreignKeys[] = new CompositeKey( |
| 35 | - ...(array)$relation->getOwnerKeyName() |
|
| 35 | + ...(array) $relation->getOwnerKeyName() |
|
| 36 | 36 | ); |
| 37 | 37 | |
| 38 | 38 | $localKeys[] = new CompositeKey( |
| 39 | - ...(array)$relation->getForeignKeyName() |
|
| 39 | + ...(array) $relation->getForeignKeyName() |
|
| 40 | 40 | ); |
| 41 | 41 | } else { |
| 42 | 42 | $foreignKeys[] = $relation->getOwnerKeyName(); |
@@ -91,11 +91,11 @@ discard block |
||
| 91 | 91 | if (is_array($relation->getForeignKeyName())) { |
| 92 | 92 | // https://github.com/topclaudy/compoships |
| 93 | 93 | $foreignKeys[] = new CompositeKey( |
| 94 | - ...(array)$relation->getForeignKeyName() |
|
| 94 | + ...(array) $relation->getForeignKeyName() |
|
| 95 | 95 | ); |
| 96 | 96 | |
| 97 | 97 | $localKeys[] = new CompositeKey( |
| 98 | - ...(array)$relation->getLocalKeyName() |
|
| 98 | + ...(array) $relation->getLocalKeyName() |
|
| 99 | 99 | ); |
| 100 | 100 | } else { |
| 101 | 101 | $foreignKeys[] = $relation->getForeignKeyName(); |
@@ -207,7 +207,7 @@ discard block |
||
| 207 | 207 | |
| 208 | 208 | foreach ($classes as $class) { |
| 209 | 209 | if ($relation instanceof $class) { |
| 210 | - return 'hasOneOrManyDeepFrom' . class_basename($class); |
|
| 210 | + return 'hasOneOrManyDeepFrom'.class_basename($class); |
|
| 211 | 211 | } |
| 212 | 212 | } |
| 213 | 213 | |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | $related = get_class($relation->getRelated()); |
| 135 | 135 | |
| 136 | 136 | if ((new $related())->getTable() !== $relation->getRelated()->getTable()) { |
| 137 | - $related .= ' from ' . $relation->getRelated()->getTable(); |
|
| 137 | + $related .= ' from '.$relation->getRelated()->getTable(); |
|
| 138 | 138 | } |
| 139 | 139 | } else { |
| 140 | 140 | $through[] = $this->hasOneOrManyThroughParent($relation, $relations[$i + 1]); |
@@ -165,11 +165,11 @@ discard block |
||
| 165 | 165 | $through = get_class($relation->getRelated()); |
| 166 | 166 | |
| 167 | 167 | if ($relation instanceof ConcatenableRelation && method_exists($relation, 'getTableForDeepRelationship')) { |
| 168 | - return $through . ' from ' . $relation->getTableForDeepRelationship(); |
|
| 168 | + return $through.' from '.$relation->getTableForDeepRelationship(); |
|
| 169 | 169 | } |
| 170 | 170 | |
| 171 | 171 | if ((new $through())->getTable() !== $relation->getRelated()->getTable()) { |
| 172 | - $through .= ' from ' . $relation->getRelated()->getTable(); |
|
| 172 | + $through .= ' from '.$relation->getRelated()->getTable(); |
|
| 173 | 173 | } |
| 174 | 174 | |
| 175 | 175 | if (get_class($relation->getRelated()) === get_class($successor->getParent())) { |
@@ -178,7 +178,7 @@ discard block |
||
| 178 | 178 | $segments = explode(' as ', $table); |
| 179 | 179 | |
| 180 | 180 | if (isset($segments[1])) { |
| 181 | - $through .= ' as ' . $segments[1]; |
|
| 181 | + $through .= ' as '.$segments[1]; |
|
| 182 | 182 | } |
| 183 | 183 | } |
| 184 | 184 | |
@@ -201,7 +201,7 @@ discard block |
||
| 201 | 201 | ?callable $customThroughKeyCallback, |
| 202 | 202 | ?callable $customEagerConstraintsCallback, |
| 203 | 203 | ?callable $customEagerMatchingCallback |
| 204 | - ): HasManyDeep|HasOneDeep { |
|
| 204 | + ): HasManyDeep | HasOneDeep { |
|
| 205 | 205 | $relation->withPostGetCallbacks($postGetCallbacks); |
| 206 | 206 | |
| 207 | 207 | if ($customThroughKeyCallback) { |
@@ -255,11 +255,11 @@ discard block |
||
| 255 | 255 | protected function addConstraintsToHasOneOrManyDeepRelationship( |
| 256 | 256 | HasManyDeep $deepRelation, |
| 257 | 257 | array $relations |
| 258 | - ): HasManyDeep|HasOneDeep { |
|
| 258 | + ): HasManyDeep | HasOneDeep { |
|
| 259 | 259 | $relations = $this->normalizeVariadicRelations($relations); |
| 260 | 260 | |
| 261 | 261 | foreach ($relations as $i => $relation) { |
| 262 | - $relationWithoutConstraints = Relation::noConstraints(function () use ($relation) { |
|
| 262 | + $relationWithoutConstraints = Relation::noConstraints(function() use ($relation) { |
|
| 263 | 263 | return $relation(); |
| 264 | 264 | }); |
| 265 | 265 | |
@@ -308,7 +308,7 @@ discard block |
||
| 308 | 308 | $deepRelation->withTrashed($deletedAtColumn); |
| 309 | 309 | } |
| 310 | 310 | |
| 311 | - if (str_starts_with($scope, HasManyDeep::class . ':')) { |
|
| 311 | + if (str_starts_with($scope, HasManyDeep::class.':')) { |
|
| 312 | 312 | $deletedAtColumn = explode(':', $scope)[1]; |
| 313 | 313 | |
| 314 | 314 | $deepRelation->withTrashed($deletedAtColumn); |
@@ -33,7 +33,7 @@ |
||
| 33 | 33 | ); |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | - $table = $throughParent->getTable() . ' as ' . $this->getRelationCountHash(); |
|
| 36 | + $table = $throughParent->getTable().' as '.$this->getRelationCountHash(); |
|
| 37 | 37 | |
| 38 | 38 | $throughParent->setTable($table); |
| 39 | 39 | |
@@ -159,7 +159,7 @@ discard block |
||
| 159 | 159 | $columns[] = $throughKey; |
| 160 | 160 | } |
| 161 | 161 | } else { |
| 162 | - $columns[] = $this->getQualifiedFirstKeyName() . " as $alias"; |
|
| 162 | + $columns[] = $this->getQualifiedFirstKeyName()." as $alias"; |
|
| 163 | 163 | } |
| 164 | 164 | |
| 165 | 165 | if ($this->hasLeadingCompositeKey()) { |
@@ -191,7 +191,7 @@ discard block |
||
| 191 | 191 | } |
| 192 | 192 | |
| 193 | 193 | foreach ($columns as $column) { |
| 194 | - $this->query->withoutGlobalScope(__CLASS__ . ":$column"); |
|
| 194 | + $this->query->withoutGlobalScope(__CLASS__.":$column"); |
|
| 195 | 195 | } |
| 196 | 196 | |
| 197 | 197 | return $this; |