diff --git a/app/Modules/LaravelSettings/SettingsRepositories/DatabaseSettingsRepository.php b/app/Modules/LaravelSettings/SettingsRepositories/DatabaseSettingsRepository.php new file mode 100644 index 000000000..3078203c9 --- /dev/null +++ b/app/Modules/LaravelSettings/SettingsRepositories/DatabaseSettingsRepository.php @@ -0,0 +1,27 @@ +map(function ($payload, $name) use ($group) { + return [ + 'group' => $group, + 'name' => $name, + 'payload' => json_encode($payload), + ]; + })->values()->toArray(); + + foreach ($propertiesInBatch as $batch) { + $this->getBuilder() + ->updateOrInsert([ + 'group' => $batch['group'], + 'name' => $batch['name'] + ], ['payload' => $batch['payload']]); + } + } +} diff --git a/app/Settings/GeneralSettings.php b/app/Settings/GeneralSettings.php index e39b5257e..792b48937 100644 --- a/app/Settings/GeneralSettings.php +++ b/app/Settings/GeneralSettings.php @@ -11,13 +11,20 @@ class GeneralSettings extends Settings public bool $enable_registration; public string|null $site_logo; public string|null $enable_social_login; + public string|null $site_language; + public string|null $default_role; + public string|null $enable_login_form; + public string|null $enable_oidc_login; public static function group(): string { + if (!auth()->guest()) { + return 'user.' . auth()->user()->id; + } return 'general'; } diff --git a/config/settings.php b/config/settings.php index 61ef24210..f99cf9cf8 100644 --- a/config/settings.php +++ b/config/settings.php @@ -32,7 +32,7 @@ */ 'repositories' => [ 'database' => [ - 'type' => Spatie\LaravelSettings\SettingsRepositories\DatabaseSettingsRepository::class, + 'type' => \App\Modules\LaravelSettings\SettingsRepositories\DatabaseSettingsRepository::class, 'model' => null, 'table' => null, 'connection' => null,