Skip to content

Commit

Permalink
Update MorphOneOrMany.php
Browse files Browse the repository at this point in the history
  • Loading branch information
crynobone authored Feb 1, 2025
1 parent e744b11 commit 210096b
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/Illuminate/Database/Eloquent/Relations/MorphOneOrMany.php
Original file line number Diff line number Diff line change
Expand Up @@ -201,9 +201,8 @@ protected function getKeys(array $models, $key = null)
$castKeyToString = in_array(SchemaBuilder::$defaultMorphKeyType, ['uuid', 'ulid', 'string']);

return (new Collection(parent::getKeys($models, $key)))
->transform(function ($key) use ($castKeyToString) {
return $castKeyToString === true ? (string) $key : $key;
})->all();
->transform(fn ($key) => $castKeyToString === true ? (string) $key : $key)
->all();
}

/** @inheritDoc */
Expand Down

0 comments on commit 210096b

Please sign in to comment.