discord seettings. cleaning up
This commit is contained in:
parent
86fd0059d2
commit
f001960eab
5 changed files with 13 additions and 10 deletions
|
@ -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");
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -43,7 +43,6 @@ class Payments
|
|||
}
|
||||
Settings::where('key', $key)->update(['value' => $param]);
|
||||
Cache::forget("setting" . ':' . $key);
|
||||
Session::remove("locale");
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -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)) {
|
||||
|
|
|
@ -49,7 +49,7 @@
|
|||
class="fas fa-home mr-2"></i>{{ __('Home') }}</a>
|
||||
</li>
|
||||
<li class="nav-item d-none d-sm-inline-block">
|
||||
<a href="{{ env('DISCORD_INVITE_URL') }}" class="nav-link" target="__blank"><i
|
||||
<a href="{{ \App\Models\Settings::getValueByKey("SETTINGS::DISCORD:INVITE_URL") }}" class="nav-link" target="__blank"><i
|
||||
class="fab fa-discord mr-2"></i>{{ __('Discord') }}</a>
|
||||
</li>
|
||||
<!-- Language Selection -->
|
||||
|
|
|
@ -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")))
|
||||
<div class="alert alert-warning p-2 m-2">
|
||||
<h5><i class="icon fas fa-exclamation-circle"></i>{{__('Required Discord verification!')}}</h5>
|
||||
{{__('You have not yet verified your discord account')}}
|
||||
|
@ -188,8 +188,8 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@if(!empty(env('DISCORD_CLIENT_ID')) && !empty(env('DISCORD_CLIENT_SECRET')))
|
||||
<div class="col-12 col-sm-5 offset-sm-1 mb-3">
|
||||
@if(!empty(\App\Models\Settings::getValueByKey("SETTINGS::DISCORD:CLIENT_ID")) && !empty(\App\Models\Settings::getValueByKey("SETTINGS::DISCORD:CLIENT_SECRET")))
|
||||
<div class="col-12 col-sm-5 offset-sm-1 mb-3">
|
||||
@if(is_null(Auth::user()->discordUser))
|
||||
<b>{{__('Link your discord account!')}}</b>
|
||||
<div class="verify-discord">
|
||||
|
|
Loading…
Reference in a new issue