From 4c2696ca6ba6d07903735033a4ce0f86e521fb90 Mon Sep 17 00:00:00 2001 From: IceToast Date: Fri, 14 Jan 2022 13:34:37 +0100 Subject: [PATCH] =?UTF-8?q?refactor:=20=F0=9F=92=84=20Changed=20model.getV?= =?UTF-8?q?alueByKey=20->=20using=20laravel=20config=20system=20(At=20App-?= =?UTF-8?q?Service-Provider)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Providers/AppServiceProvider.php | 9 +- .../admin/settings/tabs/invoices.blade.php | 15 +- .../admin/settings/tabs/language.blade.php | 73 +++---- .../views/admin/settings/tabs/misc.blade.php | 66 +++---- .../admin/settings/tabs/payments.blade.php | 65 +++---- resources/views/layouts/main.blade.php | 47 ++--- resources/views/profile/index.blade.php | 180 ++++++++++-------- resources/views/servers/index.blade.php | 6 +- resources/views/store/checkout.blade.php | 4 +- 9 files changed, 233 insertions(+), 232 deletions(-) diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index 2eb8b670..a2152366 100644 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -53,9 +53,16 @@ class AppServiceProvider extends ServiceProvider // Set Discord-API Config config(['services.discord.client_id' => Settings::getValueByKey('SETTINGS::DISCORD:CLIENT_ID')]); config(['services.discord.client_secret' => Settings::getValueByKey('SETTINGS::DISCORD:CLIENT_SECRET')]); + config(['services.discord.SETTINGS::SYSTEM:SERVER_CREATE_CHARGE_FIRST_HOUR' => 'test']); - //// Set Recaptcha API Config + // Set Recaptcha API Config config(['recaptcha.api_site_key' => Settings::getValueByKey('SETTINGS::RECAPTCHA:SITE_KEY')]); config(['recaptcha.api_secret_key' => Settings::getValueByKey('SETTINGS::RECAPTCHA:SECRET_KEY')]); + + // Set all configs from database + $settings = Settings::all(); + foreach ($settings as $setting) { + config([$setting->key => $setting->value]); + } } } diff --git a/resources/views/admin/settings/tabs/invoices.blade.php b/resources/views/admin/settings/tabs/invoices.blade.php index 6b64eae9..cf972d11 100644 --- a/resources/views/admin/settings/tabs/invoices.blade.php +++ b/resources/views/admin/settings/tabs/invoices.blade.php @@ -13,7 +13,7 @@
@@ -22,7 +22,7 @@
@@ -31,7 +31,7 @@
@@ -41,7 +41,7 @@
@@ -52,7 +52,7 @@
@@ -61,7 +61,7 @@
@@ -71,7 +71,7 @@
@@ -101,4 +101,3 @@ - diff --git a/resources/views/admin/settings/tabs/language.blade.php b/resources/views/admin/settings/tabs/language.blade.php index f013ed29..f5c649f3 100644 --- a/resources/views/admin/settings/tabs/language.blade.php +++ b/resources/views/admin/settings/tabs/language.blade.php @@ -1,6 +1,6 @@
+ action="{{ route('admin.settings.update.languagesettings') }}"> @csrf @method('PATCH') @@ -8,70 +8,59 @@
- + - + @foreach (config('app.available_locales') as $lang) + @endforeach - + - + + @foreach (config('app.available_locales') as $lang) + @endforeach
- + + required value="{{ config('SETTINGS::LOCALE:DATATABLES') }}" + class="form-control @error('datatable-language') is-invalid @enderror">
- + {{ config('SETTINGS::LOCALE:DYNAMIC') == 'true' ? 'checked' : '' }} type="checkbox"> + -
+
-
diff --git a/resources/views/admin/settings/tabs/misc.blade.php b/resources/views/admin/settings/tabs/misc.blade.php index 1b983a73..300a811b 100644 --- a/resources/views/admin/settings/tabs/misc.blade.php +++ b/resources/views/admin/settings/tabs/misc.blade.php @@ -1,6 +1,6 @@
+ action="{{ route('admin.settings.update.miscsettings') }}"> @csrf @method('PATCH') @@ -16,19 +16,19 @@ + value="{{ config('SETTINGS::MISC:PHPMYADMIN:URL') }}" + class="form-control @error('phpmyadmin-url') is-invalid @enderror">
+ id="icon">
@error('icon') - + {{ $message }} @enderror @@ -37,76 +37,72 @@
+ for="favicon">{{ __('Select panel favicon') }}
@error('favicon') - + {{ $message }} @enderror
- +
-
- + + type="text" value="{{ config('SETTINGS::DISCORD:CLIENT_SECRET') }}" + class="form-control @error('discord-client-secret') is-invalid @enderror">
- - + +
- - + +
- + + type="text" value="{{ config('SETTINGS::DISCORD:INVITE_URL') }}" + class="form-control @error('discord-invite-url') is-invalid @enderror">
- - + +
diff --git a/resources/views/admin/settings/tabs/payments.blade.php b/resources/views/admin/settings/tabs/payments.blade.php index b21f93b6..66ccb0c1 100644 --- a/resources/views/admin/settings/tabs/payments.blade.php +++ b/resources/views/admin/settings/tabs/payments.blade.php @@ -1,32 +1,30 @@
+ action="{{ route('admin.settings.update.paymentsettings') }}"> @csrf @method('PATCH')
- +
+ value="{{ config('SETTINGS::PAYMENTS:PAYPAL:CLIENT_ID') }}" + class="form-control @error('paypal-client-id') is-invalid @enderror">
-
@@ -36,8 +34,8 @@ + value="{{ config('SETTINGS::PAYMENTS:PAYPAL:SANDBOX_CLIENT_ID') }}" + class="form-control @error('paypal-sandbox-id') is-invalid @enderror">
@@ -47,24 +45,22 @@ + type="text" value="{{ config('SETTINGS::PAYMENTS:PAYPAL:SANDBOX_SECRET') }}" + class="form-control @error('paypal-sandbox-secret') is-invalid @enderror">
- +
-
@@ -72,9 +68,9 @@
+ name="stripe-endpoint-secret" type="text" + value="{{ config('SETTINGS::PAYMENTS:STRIPE:ENDPOINT_SECRET') }}" + class="form-control @error('stripe-endpoint-secret') is-invalid @enderror">
@@ -83,9 +79,8 @@
+ type="text" value="{{ config('SETTINGS::PAYMENTS:STRIPE:TEST_SECRET') }}" + class="form-control @error('stripe-test-secret') is-invalid @enderror">
@@ -95,20 +90,21 @@ + name="stripe-endpoint-test-secret" type="text" + value="{{ config('SETTINGS::PAYMENTS:STRIPE:ENDPOINT_TEST_SECRET') }}" + class="form-control @error('stripe-endpoint-test-secret') is-invalid @enderror">
-
@@ -122,10 +118,10 @@
+ for="sales_tax">{{ __('The %-value of tax that will be added to the product price on checkout') }} + value="{{ config('SETTINGS::PAYMENTS:SALES_TAX') }}" + class="form-control @error('sales_tax') is-invalid @enderror">
@@ -137,4 +133,3 @@ - diff --git a/resources/views/layouts/main.blade.php b/resources/views/layouts/main.blade.php index 7423eff1..072ef13a 100644 --- a/resources/views/layouts/main.blade.php +++ b/resources/views/layouts/main.blade.php @@ -49,34 +49,34 @@ class="fas fa-home mr-2">
{{ __('Home') }} - @if (\App\Models\Settings::getValueByKey("SETTINGS::LOCALE:CLIENTS_CAN_CHANGE")=='true') - + + @endif @@ -211,7 +211,7 @@ - @if ((\App\Models\Settings::getValueByKey("SETTINGS::PAYMENTS:PAYPAL:SECRET") && \App\Models\Settings::getValueByKey("SETTINGS::PAYMENTS:PAYPAL:CLIENT_ID")) || env('APP_ENV', 'local') == 'local') + @if ((config('SETTINGS::PAYMENTS:PAYPAL:SECRET') && config('SETTINGS::PAYMENTS:PAYPAL:CLIENT_ID')) || env('APP_ENV', 'local') == 'local')