@@ -123,7 +123,7 @@ public function sync($ids, $detaching = true)
123123 // First we need to attach any of the associated models that are not currently
124124 // in this joining table. We'll spin through the given IDs, checking to see
125125 // 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 } ?: [];
127127
128128 // See issue #256.
129129 if ($ current instanceof Collection) {
@@ -196,7 +196,7 @@ public function attach($id, array $attributes = [], $touch = true)
196196 }
197197
198198 // 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 );
200200
201201 if (! $ touch ) {
202202 return ;
@@ -220,7 +220,7 @@ public function detach($ids = [], $touch = true)
220220 $ ids = (array ) $ ids ;
221221
222222 // Detach all ids from the parent model.
223- $ this ->parent ->pull ($ this ->getRelatedKey () , $ ids );
223+ $ this ->parent ->pull ($ this ->relatedPivotKey , $ ids );
224224
225225 // Prepare the query to select all related objects.
226226 if (count ($ ids ) > 0 ) {
@@ -316,16 +316,6 @@ protected function formatSyncList(array $records)
316316 return $ results ;
317317 }
318318
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-
329319 /**
330320 * Get the name of the "where in" method for eager loading.
331321 *
0 commit comments