We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 168cf9b commit 478c25eCopy full SHA for 478c25e
tests/EmbeddedRelationsTest.php
@@ -972,4 +972,18 @@ public function testUnsetPropertyOnEmbed()
972
$this->assertNull($user->addresses->get(0)->city);
973
$this->assertSame('Kyoto', $user->addresses->get(1)->city);
974
}
975
+
976
+ public function testEmbedManyToArrayCast()
977
+ {
978
+ $user = User::create(['name' => 'John Doe']);
979
+ $user->addresses()->saveMany([new Address(['city' => 'London'])]);
980
981
+ //Reload document
982
+ $user = User::where('name', 'John Doe')->first();
983
+ $array = $user->toArray();
984
985
+ $this->assertIsString($array['addresses'][0]['id']);
986
+ $this->assertIsString($array['addresses'][0]['created_at']);
987
+ $this->assertIsString($array['addresses'][0]['updated_at']);
988
+ }
989
0 commit comments