Aplikasi Keuangan yang mengatur lalu lintas transaksi antara bank dan aplikasi internal Kampus
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

22 lines
584 B

<?php
namespace App\Domains\Identity\Actions\IdentityMaintenance;
use App\Domains\Identity\Enums\UserSettingKey;
use App\Domains\Identity\Models\User;
class UpdateUserSettings
{
public function execute(User $user, array $newSettings): void
{
$currentSettings = $user->settings ?? [];
foreach (UserSettingKey::cases() as $key) {
if (array_key_exists($key->value, $newSettings)) {
$currentSettings[$key->value] = $newSettings[$key->value];
}
}
$user->update(['settings' => $currentSettings]);
}
}