@@ -123,7 +123,7 @@ public function sync($ids, $detaching = true)
123
123
// First we need to attach any of the associated models that are not currently
124
124
// in this joining table. We'll spin through the given IDs, checking to see
125
125
// if they exist in the array of current ones, and if not we will insert.
126
- $ current = $ this ->parent ->{$ this ->getRelatedKey () } ?: [];
126
+ $ current = $ this ->parent ->{$ this ->relatedPivotKey } ?: [];
127
127
128
128
// See issue #256.
129
129
if ($ current instanceof Collection) {
@@ -196,7 +196,7 @@ public function attach($id, array $attributes = [], $touch = true)
196
196
}
197
197
198
198
// Attach the new ids to the parent model.
199
- $ this ->parent ->push ($ this ->getRelatedKey () , (array ) $ id , true );
199
+ $ this ->parent ->push ($ this ->relatedPivotKey , (array ) $ id , true );
200
200
201
201
if (! $ touch ) {
202
202
return ;
@@ -220,7 +220,7 @@ public function detach($ids = [], $touch = true)
220
220
$ ids = (array ) $ ids ;
221
221
222
222
// Detach all ids from the parent model.
223
- $ this ->parent ->pull ($ this ->getRelatedKey () , $ ids );
223
+ $ this ->parent ->pull ($ this ->relatedPivotKey , $ ids );
224
224
225
225
// Prepare the query to select all related objects.
226
226
if (count ($ ids ) > 0 ) {
@@ -316,16 +316,6 @@ protected function formatSyncList(array $records)
316
316
return $ results ;
317
317
}
318
318
319
- /**
320
- * Get the related key with backwards compatible support.
321
- *
322
- * @return string
323
- */
324
- public function getRelatedKey ()
325
- {
326
- return property_exists ($ this , 'relatedPivotKey ' ) ? $ this ->relatedPivotKey : $ this ->relatedKey ;
327
- }
328
-
329
319
/**
330
320
* Get the name of the "where in" method for eager loading.
331
321
*
0 commit comments