@@ -18,7 +18,7 @@ class BelongsTo extends \Illuminate\Database\Eloquent\Relations\BelongsTo
1818 */
1919 public function getHasCompareKey ()
2020 {
21- return $ this ->getOwnerKey () ;
21+ return $ this ->ownerKey ;
2222 }
2323
2424 /** @inheritdoc */
@@ -28,7 +28,7 @@ public function addConstraints()
2828 // For belongs to relationships, which are essentially the inverse of has one
2929 // or has many relationships, we need to actually query on the primary key
3030 // of the related models matching on the foreign key that's on a parent.
31- $ this ->query ->where ($ this ->getOwnerKey () , '= ' , $ this ->parent ->{$ this ->foreignKey });
31+ $ this ->query ->where ($ this ->ownerKey , '= ' , $ this ->parent ->{$ this ->foreignKey });
3232 }
3333 }
3434
@@ -38,9 +38,7 @@ public function addEagerConstraints(array $models)
3838 // We'll grab the primary key name of the related models since it could be set to
3939 // a non-standard name and not "id". We will then construct the constraint for
4040 // our eagerly loading query so it returns the proper models from execution.
41- $ key = $ this ->getOwnerKey ();
42-
43- $ this ->query ->whereIn ($ key , $ this ->getEagerModelKeys ($ models ));
41+ $ this ->query ->whereIn ($ this ->ownerKey , $ this ->getEagerModelKeys ($ models ));
4442 }
4543
4644 /** @inheritdoc */
@@ -49,16 +47,6 @@ public function getRelationExistenceQuery(Builder $query, Builder $parentQuery,
4947 return $ query ;
5048 }
5149
52- /**
53- * Get the owner key with backwards compatible support.
54- *
55- * @return string
56- */
57- public function getOwnerKey ()
58- {
59- return property_exists ($ this , 'ownerKey ' ) ? $ this ->ownerKey : $ this ->otherKey ;
60- }
61-
6250 /**
6351 * Get the name of the "where in" method for eager loading.
6452 *
0 commit comments