File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -303,7 +303,11 @@ public function remove($key)
303303
304304 public function merge ($ data )
305305 {
306- $ this ->data ($ this ->data ()->merge (collect ($ data )->filter (fn ($ v ) => $ v !== null )->all ()));
306+ $ merged = $ this ->data ()
307+ ->except (['roles ' , 'groups ' ])
308+ ->merge (collect ($ data )->filter (fn ($ v ) => $ v !== null )->all ());
309+
310+ $ this ->data ($ merged ->all ());
307311
308312 return $ this ;
309313 }
Original file line number Diff line number Diff line change @@ -335,6 +335,20 @@ public function it_does_not_save_null_values_on_the_model()
335335 $ this ->assertFalse ($ attributes ['not_null_field ' ]);
336336 }
337337
338+ #[Test]
339+ public function merge_does_not_set_roles_and_groups_as_model_attributes ()
340+ {
341+ $ user = $ this ->user ();
342+
343+ $ user ->merge (['name ' => 'Updated Name ' ]);
344+
345+ $ attributes = $ user ->model ()->getAttributes ();
346+
347+ $ this ->assertArrayNotHasKey ('roles ' , $ attributes );
348+ $ this ->assertArrayNotHasKey ('groups ' , $ attributes );
349+ $ this ->assertEquals ('Updated Name ' , $ attributes ['name ' ]);
350+ }
351+
338352 #[Test]
339353 #[Group('passkeys ' )]
340354 public function it_gets_passkeys ()
You can’t perform that action at this time.
0 commit comments