Skip to content

Commit 42cf4a3

Browse files
committed
replace with the suggested "new" method
1 parent 482f918 commit 42cf4a3

File tree

1 file changed

+1
-24
lines changed

1 file changed

+1
-24
lines changed

src/Relations/BelongsToMany.php

+1-24
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
use function array_values;
1818
use function assert;
1919
use function count;
20-
use function is_array;
2120
use function is_numeric;
2221

2322
class BelongsToMany extends EloquentBelongsToMany
@@ -132,7 +131,7 @@ public function sync($ids, $detaching = true)
132131
$current = $ids->modelKeys();
133132
}
134133

135-
$records = $this->formatSyncList($ids);
134+
$records = $this->formatRecordsList($ids);
136135

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

@@ -299,28 +298,6 @@ public function getQualifiedRelatedPivotKeyName()
299298
return $this->relatedPivotKey;
300299
}
301300

302-
/**
303-
* Format the sync list so that it is keyed by ID. (Legacy Support)
304-
* The original function has been renamed to formatRecordsList since Laravel 5.3.
305-
*
306-
* @deprecated
307-
*
308-
* @return array
309-
*/
310-
protected function formatSyncList(array $records)
311-
{
312-
$results = [];
313-
foreach ($records as $id => $attributes) {
314-
if (! is_array($attributes)) {
315-
[$id, $attributes] = [$attributes, []];
316-
}
317-
318-
$results[$id] = $attributes;
319-
}
320-
321-
return $results;
322-
}
323-
324301
/**
325302
* Get the name of the "where in" method for eager loading.
326303
*

0 commit comments

Comments
 (0)