Additional User Attributes
Laritor records an authenticated user with the required id, name, and email fields. You can send additional attributes, such as a user’s role or team, by customizing the data redactor.
Configure a Custom Redactor
Section titled “Configure a Custom Redactor”If you have not already done so, publish and register a custom data redactor.
Add User Attributes
Section titled “Add User Attributes”Override redactAuthenticatedUser() and return the required user fields along with any additional attributes you want Laritor to receive.
The
id,name, andnullfor these fields.
public function redactAuthenticatedUser(): array{ $user = Auth::user();
if ($user) { return [ 'id' => $user->id, 'name' => $user->name, 'email' => $user->email, 'team' => [ 'id' => $user->team->id, 'name' => $user->team->name, ], 'role' => $user->role, ]; }
return parent::redactAuthenticatedUser();}Choose attributes that are useful for investigating application behavior, and make sure your redactor continues to omit or anonymize any sensitive data your application should not send.