Skip to content

Commit

Permalink
fix conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorotwell committed Nov 18, 2020
2 parents c942d21 + 091a784 commit 1e516c6
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
17 changes: 17 additions & 0 deletions Eloquent/Collection.php
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,23 @@ public function map(callable $callback)
}) ? $result->toBase() : $result;
}

/**
* Run an associative map over each of the items.
*
* The callback should return an associative array with a single key / value pair.
*
* @param callable $callback
* @return \Illuminate\Support\Collection|static
*/
public function mapWithKeys(callable $callback)
{
$result = parent::mapWithKeys($callback);

return $result->contains(function ($item) {
return ! $item instanceof Model;
}) ? $result->toBase() : $result;
}

/**
* Reload a fresh model instance from the database for all the entities.
*
Expand Down
2 changes: 2 additions & 0 deletions Eloquent/Relations/Concerns/AsPivot.php
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,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 1e516c6

Please sign in to comment.