Skip to content

Commit

Permalink
Reset array keys for restoration (#35218)
Browse files Browse the repository at this point in the history
  • Loading branch information
driesvints authored Nov 13, 2020
1 parent a6c18dc commit 091a784
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Eloquent/Relations/Concerns/AsPivot.php
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,8 @@ public function newQueryForRestoration($ids)
*/
protected function newQueryForCollectionRestoration(array $ids)
{
$ids = array_values($ids);

if (! Str::contains($ids[0], ':')) {
return parent::newQueryForRestoration($ids);
}
Expand Down
2 changes: 2 additions & 0 deletions Eloquent/Relations/MorphPivot.php
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,8 @@ public function newQueryForRestoration($ids)
*/
protected function newQueryForCollectionRestoration(array $ids)
{
$ids = array_values($ids);

if (! Str::contains($ids[0], ':')) {
return parent::newQueryForRestoration($ids);
}
Expand Down

0 comments on commit 091a784

Please # to comment.