File tree Expand file tree Collapse file tree 2 files changed +7
-4
lines changed Expand file tree Collapse file tree 2 files changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -16,8 +16,11 @@ public function addConstraints()
16
16
// For belongs to relationships, which are essentially the inverse of has one
17
17
// or has many relationships, we need to actually query on the primary key
18
18
// of the related models matching on the foreign key that's on a parent.
19
- $ this ->query ->where ($ this ->ownerKey ?: $ this ->query ->getModel ()->getKeyName (), '= ' ,
20
- $ this ->parent ->{$ this ->foreignKey });
19
+ $ this ->query ->where (
20
+ $ this ->ownerKey ?: $ this ->query ->getModel ()->getKeyName (),
21
+ '= ' ,
22
+ $ this ->parent ->{$ this ->foreignKey },
23
+ );
21
24
}
22
25
}
23
26
Original file line number Diff line number Diff line change @@ -481,8 +481,8 @@ public function testMorph(): void
481
481
$ this ->assertEquals ($ client ->_id , $ photo ->hasImage ->_id );
482
482
483
483
// inverse with custom ownerKey
484
- $ photo = Photo::query ()->create ([ 'url ' => 'https://graph.facebook.com/young.gerald/picture ' ]);
485
- $ client = Client::create (['cclient_id ' => (string ) (new ObjectId ()),'name ' => 'Young Gerald ' ]);
484
+ $ photo = Photo::query ()->create (['url ' => 'https://graph.facebook.com/young.gerald/picture ' ]);
485
+ $ client = Client::create (['cclient_id ' => (string ) (new ObjectId ()), 'name ' => 'Young Gerald ' ]);
486
486
$ photo ->hasImageWithCustomOwnerKey ()->associate ($ client )->save ();
487
487
488
488
$ this ->assertCount (1 , $ photo ->hasImageWithCustomOwnerKey ()->get ());
You can’t perform that action at this time.
0 commit comments