| @@ -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 | } | 
| @@ -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]); | 
| @@ -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; | 
| @@ -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 ($keys) { | |
| 58 | +            function(Builder $query) use ($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 | ); | 
| @@ -25,7 +25,7 @@ discard block | ||
| 25 | 25 | public function appendToDeepRelationship(array $through, array $foreignKeys, array $localKeys, int $position): array | 
| 26 | 26 |      { | 
| 27 | 27 |          if ($position === 0) { | 
| 28 | -            $foreignKeys[] = function (Builder $query, Builder $parentQuery = null) { | |
| 28 | +            $foreignKeys[] = function(Builder $query, Builder $parentQuery = null) { | |
| 29 | 29 |                  if ($parentQuery) { | 
| 30 | 30 | $this->getRelationExistenceQuery($this->query, $parentQuery); | 
| 31 | 31 | } | 
| @@ -35,9 +35,9 @@ discard block | ||
| 35 | 35 | |
| 36 | 36 | $localKeys[] = $this->localKey; | 
| 37 | 37 |          } else { | 
| 38 | -            $foreignKeys[] = function (Builder $query, JoinClause $join) { | |
| 38 | +            $foreignKeys[] = function(Builder $query, JoinClause $join) { | |
| 39 | 39 | $join->on( | 
| 40 | -                    function (JoinClause $join) { | |
| 40 | +                    function(JoinClause $join) { | |
| 41 | 41 |                          foreach ($this->foreignKeys as $foreignKey) { | 
| 42 | 42 | $join->orOn($foreignKey, '=', $this->getQualifiedParentKeyName()); | 
| 43 | 43 | } | 
| @@ -62,7 +62,7 @@ discard block | ||
| 62 | 62 | $columns = []; | 
| 63 | 63 | |
| 64 | 64 |          foreach ($this->foreignKeys as $i => $foreignKey) { | 
| 65 | - $columns[] = "$foreignKey as $alias" . ($i > 0 ? "_$i" : ''); | |
| 65 | + $columns[] = "$foreignKey as $alias".($i > 0 ? "_$i" : ''); | |
| 66 | 66 | } | 
| 67 | 67 | |
| 68 | 68 | return $columns; | 
| @@ -117,7 +117,7 @@ discard block | ||
| 117 | 117 | $dictionary = []; | 
| 118 | 118 | |
| 119 | 119 | $foreignKeyNames = array_map( | 
| 120 | - fn ($i) => 'laravel_through_key' . ($i > 0 ? "_$i" : ''), | |
| 120 | + fn ($i) => 'laravel_through_key'.($i > 0 ? "_$i" : ''), | |
| 121 | 121 | range(0, count($this->foreignKeys) - 1) | 
| 122 | 122 | ); | 
| 123 | 123 | |