Skip to content

Commit 1e516c6

Browse files
committed
fix conflicts
2 parents c942d21 + 091a784 commit 1e516c6

File tree

3 files changed

+21
-0
lines changed

3 files changed

+21
-0
lines changed

Eloquent/Collection.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,23 @@ public function map(callable $callback)
280280
}) ? $result->toBase() : $result;
281281
}
282282

283+
/**
284+
* Run an associative map over each of the items.
285+
*
286+
* The callback should return an associative array with a single key / value pair.
287+
*
288+
* @param callable $callback
289+
* @return \Illuminate\Support\Collection|static
290+
*/
291+
public function mapWithKeys(callable $callback)
292+
{
293+
$result = parent::mapWithKeys($callback);
294+
295+
return $result->contains(function ($item) {
296+
return ! $item instanceof Model;
297+
}) ? $result->toBase() : $result;
298+
}
299+
283300
/**
284301
* Reload a fresh model instance from the database for all the entities.
285302
*

Eloquent/Relations/Concerns/AsPivot.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,8 @@ public function newQueryForRestoration($ids)
286286
*/
287287
protected function newQueryForCollectionRestoration(array $ids)
288288
{
289+
$ids = array_values($ids);
290+
289291
if (! Str::contains($ids[0], ':')) {
290292
return parent::newQueryForRestoration($ids);
291293
}

Eloquent/Relations/MorphPivot.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,8 @@ public function newQueryForRestoration($ids)
139139
*/
140140
protected function newQueryForCollectionRestoration(array $ids)
141141
{
142+
$ids = array_values($ids);
143+
142144
if (! Str::contains($ids[0], ':')) {
143145
return parent::newQueryForRestoration($ids);
144146
}

0 commit comments

Comments
 (0)