Skip to content

Commit

Permalink
replace with the suggested "new" method
Browse files Browse the repository at this point in the history
  • Loading branch information
Treggats committed Nov 22, 2023
1 parent 482f918 commit 42cf4a3
Showing 1 changed file with 1 addition and 24 deletions.
25 changes: 1 addition & 24 deletions src/Relations/BelongsToMany.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
use function array_values;
use function assert;
use function count;
use function is_array;
use function is_numeric;

class BelongsToMany extends EloquentBelongsToMany
Expand Down Expand Up @@ -132,7 +131,7 @@ public function sync($ids, $detaching = true)
$current = $ids->modelKeys();
}

$records = $this->formatSyncList($ids);
$records = $this->formatRecordsList($ids);

$current = Arr::wrap($current);

Expand Down Expand Up @@ -299,28 +298,6 @@ public function getQualifiedRelatedPivotKeyName()
return $this->relatedPivotKey;
}

/**
* Format the sync list so that it is keyed by ID. (Legacy Support)
* The original function has been renamed to formatRecordsList since Laravel 5.3.
*
* @deprecated
*
* @return array
*/
protected function formatSyncList(array $records)
{
$results = [];
foreach ($records as $id => $attributes) {
if (! is_array($attributes)) {
[$id, $attributes] = [$attributes, []];
}

$results[$id] = $attributes;
}

return $results;
}

/**
* Get the name of the "where in" method for eager loading.
*
Expand Down

0 comments on commit 42cf4a3

Please sign in to comment.