diff --git a/app/Classes/Settings/Misc.php b/app/Classes/Settings/Misc.php index 75386c6f..6673513a 100644 --- a/app/Classes/Settings/Misc.php +++ b/app/Classes/Settings/Misc.php @@ -5,6 +5,7 @@ namespace App\Classes\Settings; use App\Models\Settings; use Illuminate\Http\Request; use Illuminate\Support\Facades\Cache; +use Illuminate\Support\Facades\Config; use Illuminate\Support\Facades\Session; class Misc @@ -46,6 +47,9 @@ class Misc ]; + Config::set('services.discord.client_id', $request->get("discord-client-id")); + Config::set('services.discord.client_secret', $request->get("discord-client-secret")); + foreach ($values as $key => $value) { $param = $request->get($value); @@ -54,7 +58,7 @@ class Misc } Settings::where('key', $key)->update(['value' => $param]); Cache::forget("setting" . ':' . $key); - Session::remove("locale"); + } diff --git a/app/Classes/Settings/Payments.php b/app/Classes/Settings/Payments.php index debe40ea..d1bb8e05 100644 --- a/app/Classes/Settings/Payments.php +++ b/app/Classes/Settings/Payments.php @@ -43,7 +43,6 @@ class Payments } Settings::where('key', $key)->update(['value' => $param]); Cache::forget("setting" . ':' . $key); - Session::remove("locale"); } diff --git a/app/Http/Controllers/Auth/SocialiteController.php b/app/Http/Controllers/Auth/SocialiteController.php index 08310231..04b6f203 100644 --- a/app/Http/Controllers/Auth/SocialiteController.php +++ b/app/Http/Controllers/Auth/SocialiteController.php @@ -15,7 +15,7 @@ class SocialiteController extends Controller { public function redirect() { - $scopes = !empty(env('DISCORD_BOT_TOKEN')) && !empty(env('DISCORD_GUILD_ID')) ? ['guilds.join'] : []; + $scopes = !empty(Settings::getValueByKey("SETTINGS::DISCORD:BOT_TOKEN")) && !empty(Settings::getValueByKey("SETTINGS::DISCORD:GUILD_ID")) ? ['guilds.join'] : []; return Socialite::driver('discord') ->scopes($scopes) @@ -31,9 +31,9 @@ class SocialiteController extends Controller /** @var User $user */ $user = Auth::user(); $discord = Socialite::driver('discord')->user(); - $botToken = env('DISCORD_BOT_TOKEN'); - $guildId = env('DISCORD_GUILD_ID'); - $roleId = env('DISCORD_ROLE_ID'); + $botToken = Settings::getValueByKey("SETTINGS::DISCORD:BOT_TOKEN"); + $guildId = Settings::getValueByKey("SETTINGS::DISCORD:GUILD_ID"); + $roleId = Settings::getValueByKey("SETTINGS::DISCORD:ROLE_ID"); //save / update discord_users if (is_null($user->discordUser)) { diff --git a/resources/views/layouts/main.blade.php b/resources/views/layouts/main.blade.php index 1570cf19..7423eff1 100644 --- a/resources/views/layouts/main.blade.php +++ b/resources/views/layouts/main.blade.php @@ -49,7 +49,7 @@ class="fas fa-home mr-2">{{ __('Home') }} diff --git a/resources/views/profile/index.blade.php b/resources/views/profile/index.blade.php index 3a02f5b8..b0c41bcb 100644 --- a/resources/views/profile/index.blade.php +++ b/resources/views/profile/index.blade.php @@ -36,7 +36,7 @@ @endif @if(is_null(Auth::user()->discordUser) && strtolower($force_discord_verification) == 'true') - @if(!empty(env('DISCORD_CLIENT_ID')) && !empty(env('DISCORD_CLIENT_SECRET'))) + @if(!empty(\App\Models\Settings::getValueByKey("SETTINGS::DISCORD:CLIENT_ID")) && !empty(\App\Models\Settings::getValueByKey("SETTINGS::DISCORD:CLIENT_SECRET")))
{{__('Required Discord verification!')}}
{{__('You have not yet verified your discord account')}} @@ -188,8 +188,8 @@
- @if(!empty(env('DISCORD_CLIENT_ID')) && !empty(env('DISCORD_CLIENT_SECRET'))) -
+ @if(!empty(\App\Models\Settings::getValueByKey("SETTINGS::DISCORD:CLIENT_ID")) && !empty(\App\Models\Settings::getValueByKey("SETTINGS::DISCORD:CLIENT_SECRET"))) +
@if(is_null(Auth::user()->discordUser)) {{__('Link your discord account!')}}