hashPassword($password); $user = User::create($data); return $user; } public function handleUpdate(User $user, array $data): User { if (isset($data['email'])) { $data['email'] = Str::lower($data['email']); } if (isset($data['password'])) { unset($data['password']); } $user->update($data); $user->touch(); return $user; } public function handleConfirmationByEmail(User $user): void { $user->update(['email_verified_at' => new Carbon('NOW')]); } public function handleUpdatePassword(User $user, int|string $password): void { $user->update(['password' => $this->hashPassword($password)]); } public function handleSyncRoles(User $user, ManyRoleDto $roles): void { $user->roles()->sync($roles->toArray()); } private function hashPassword(int|string $password): string { return Hash::make($password); } public function handleDestroy(User $user): void { $user->delete(); } }