Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Auth/Eloquent/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public function data($data = null)
return collect(Arr::except($data, ['id', 'email']));
}

foreach ($data as $key => $value) {
foreach (Arr::except($data, ['roles', 'groups']) as $key => $value) {
$this->set($key, $value);
}

Expand Down
14 changes: 14 additions & 0 deletions tests/Auth/Eloquent/EloquentUserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,20 @@ public function merge_does_not_set_roles_and_groups_as_model_attributes()
$this->assertEquals('Updated Name', $attributes['name']);
}

#[Test]
public function data_does_not_set_roles_and_groups_as_model_attributes()
{
$user = $this->user();

$user->data($user->data()->merge(['name' => 'Updated Name'])->all());

$attributes = $user->model()->getAttributes();

$this->assertArrayNotHasKey('roles', $attributes);
$this->assertArrayNotHasKey('groups', $attributes);
$this->assertEquals('Updated Name', $attributes['name']);
}

#[Test]
#[Group('passkeys')]
public function it_gets_passkeys()
Expand Down
Loading