diff --git a/.env.example b/.env.example index cd370fd7..755c5511 100644 --- a/.env.example +++ b/.env.example @@ -8,18 +8,6 @@ APP_URL=http://localhost APP_TIMEZONE=UTC ### --- App Settings End --- ### -### --- Localization settings --- ### -# If set to true, Language is chosen automatically depending on the users browserlanguage. -DYNAMIC_LOCALE = false -# The language of the Dashboard. This is also the fallback if dynamic_locale is true but no translation is found -LOCALE=en -# You can grab the Language-Codes for the Datatables from this Website https://datatables.net/plug-ins/i18n/ -DATATABLE_LOCALE=en-gb -#The languages you DO NOT want to support on your Controlpanel split by comma. -#Remove the language to make it available -UNSUPPORTED_LOCALES=german,italian,chinese -### --- Localization settings End --- ### - ### --- DB Settings (required) --- ### DB_CONNECTION=mysql DB_HOST=127.0.0.1 @@ -29,42 +17,6 @@ DB_USERNAME=dashboarduser DB_PASSWORD= ### --- DB Settings End --- ### -### --- Payment Options (required for payments) --- ### -# Paypal API Credentials - https://developer.paypal.com/docs/integration/direct/rest/ - Sandbox credentials are being used when APP_ENV is set to local -PAYPAL_SANDBOX_SECRET= -PAYPAL_SANDBOX_CLIENT_ID= -PAYPAL_SECRET= -PAYPAL_CLIENT_ID= - -# Stripe API Credentials - https://dashboard.stripe.com/account/apikeys - Test credentials are being used when APP_ENV is set to local -STRIPE_TEST_SECRET= -STRIPE_SECRET= -#https://dashboard.stripe.com/webhooks -> webhook route: /payment/StripeWebhooks -STRIPE_ENDPOINT_TEST_SECRET= -STRIPE_ENDPOINT_SECRET= -# Stripe payment methods - comma seperated list of payment methods that are enabled https://stripe.com/docs/payments/payment-methods/integration-options -STRIPE_METHODS= -### --- Payment Options End --- ### - -### --- Discord Settings (optional) --- ### -# Discord API Credentials - https://discordapp.com/developers/applications/ -DISCORD_CLIENT_ID= -DISCORD_CLIENT_SECRET= -# Bot Settings - will join users to your discord -DISCORD_BOT_TOKEN= -DISCORD_GUILD_ID= -# Discord role that will be assigned to users when they register -DISCORD_ROLE_ID= -### --- Discord Settings End --- ### - -### --- Controlpanel Settings (required) --- ### -# Controlpanel URL Settings - URLs must not end with a slash! -PTERODACTYL_URL=https://panel.controlpanel.gg # required -PHPMYADMIN_URL=https://mysql.controlpanel.gg #optional. remove to remove database button -DISCORD_INVITE_URL=https://discord.gg/vrUYdxG4wZ #optional -# Admin API Token from Pterodactyl Panel - Nececary for the Panel to work -PTERODACTYL_TOKEN= -### --- Controlpanel Settings End --- ### # Google Recaptcha API Credentials - https://www.google.com/recaptcha/admin - reCaptcha V2 (not v3) RECAPTCHA_SITE_KEY=6LeIxAcTAAAAAJcZVRqyHh71UMIEGNQ_MXjiZKhI diff --git a/app/Classes/Pterodactyl.php b/app/Classes/Pterodactyl.php index 20caa00a..4ffed33f 100644 --- a/app/Classes/Pterodactyl.php +++ b/app/Classes/Pterodactyl.php @@ -2,11 +2,11 @@ namespace App\Classes; -use App\Models\Configuration; use App\Models\Egg; use App\Models\Nest; use App\Models\Node; use App\Models\Server; +use App\Models\Settings; use Exception; use Illuminate\Http\Client\PendingRequest; use Illuminate\Http\Client\Response; @@ -27,10 +27,10 @@ class Pterodactyl public static function client() { return Http::withHeaders([ - 'Authorization' => 'Bearer ' . env('PTERODACTYL_TOKEN', false), + 'Authorization' => 'Bearer ' . config("SETTINGS::SYSTEM:PTERODACTYL:TOKEN"), 'Content-type' => 'application/json', 'Accept' => 'Application/vnd.pterodactyl.v1+json', - ])->baseUrl(env('PTERODACTYL_URL') . '/api'); + ])->baseUrl(config("SETTINGS::SYSTEM:PTERODACTYL:URL") . '/api'); } /** @@ -141,7 +141,7 @@ class Pterodactyl */ public static function getAllocations(Node $node) { - $per_page = Configuration::getValueByKey('ALLOCATION_LIMIT', 200); + $per_page = config('SETTINGS::SERVER:ALLOCATION_LIMIT', 200); try { $response = self::client()->get("/application/nodes/{$node->id}/allocations?per_page={$per_page}"); } catch (Exception $e) { @@ -158,7 +158,7 @@ class Pterodactyl */ public static function url(string $route): string { - return env('PTERODACTYL_URL') . $route; + return config("SETTINGS::SYSTEM:PTERODACTYL:URL") . $route; } /** diff --git a/app/Classes/Settings/Invoices.php b/app/Classes/Settings/Invoices.php new file mode 100644 index 00000000..425af60c --- /dev/null +++ b/app/Classes/Settings/Invoices.php @@ -0,0 +1,50 @@ +validate([ + 'logo' => 'nullable|max:10000|mimes:jpg,png,jpeg', + ]); + + $values = [ + //SETTINGS::VALUE => REQUEST-VALUE (coming from the html-form) + "SETTINGS::INVOICE:COMPANY_NAME" => "company-name", + "SETTINGS::INVOICE:COMPANY_ADDRESS" => "company-address", + "SETTINGS::INVOICE:COMPANY_PHONE" => "company-phone", + "SETTINGS::INVOICE:COMPANY_MAIL" => "company-mail", + "SETTINGS::INVOICE:COMPANY_VAT" => "company-vat", + "SETTINGS::INVOICE:COMPANY_WEBSITE" => "company-web", + "SETTINGS::INVOICE:PREFIX" => "invoice-prefix", + "SETTINGS::INVOICE:ENABLED" => "enable-invoices", + ]; + + foreach ($values as $key => $value) { + $param = $request->get($value); + + Settings::where('key', $key)->updateOrCreate(['key' => $key], ['value' => $param]); + Cache::forget("setting" . ':' . $key); + } + + + if ($request->hasFile('logo')) { + $request->file('logo')->storeAs('public', 'logo.png'); + } + + + return redirect(route('admin.settings.index') . '#invoices')->with('success', __('Invoice settings updated!')); + } +} diff --git a/app/Classes/Settings/Language.php b/app/Classes/Settings/Language.php new file mode 100644 index 00000000..5f9b87fe --- /dev/null +++ b/app/Classes/Settings/Language.php @@ -0,0 +1,61 @@ +all(), [ + 'autotranslate' => 'string', + 'canClientChangeLanguage' => 'string', + 'defaultLanguage' => 'required|string', + 'languages' => 'required|array', + 'languages.*' => 'required|string', + 'datatable-language' => 'required|string', + ]); + + + if ($validator->fails()) { + return redirect(route('admin.settings.index') . '#language')->with('error', __('Language settings have not been updated!'))->withErrors($validator); + } + + $values = [ + //SETTINGS::VALUE => REQUEST-VALUE (coming from the html-form) + "SETTINGS::LOCALE:DEFAULT" => "defaultLanguage", + "SETTINGS::LOCALE:DYNAMIC" => "autotranslate", + "SETTINGS::LOCALE:CLIENTS_CAN_CHANGE" => "canClientChangeLanguage", + "SETTINGS::LOCALE:AVAILABLE" => "languages", + "SETTINGS::LOCALE:DATATABLES" => "datatable-language" + ]; + + + foreach ($values as $key => $value) { + $param = $request->get($value); + + if (is_array($param)) { + $param = implode(",", $param); + } + + Settings::where('key', $key)->updateOrCreate(['key' => $key], ['value' => $param]); + Cache::forget("setting" . ':' . $key); + Session::remove("locale"); + } + + + return redirect(route('admin.settings.index') . '#language')->with('success', __('Language settings updated!')); + } +} diff --git a/app/Classes/Settings/Misc.php b/app/Classes/Settings/Misc.php new file mode 100644 index 00000000..beaa3a44 --- /dev/null +++ b/app/Classes/Settings/Misc.php @@ -0,0 +1,85 @@ +all(), [ + 'icon' => 'nullable|max:10000|mimes:jpg,png,jpeg', + 'favicon' => 'nullable|max:10000|mimes:ico', + 'discord-bot-token' => 'nullable|string', + 'discord-client-id' => 'nullable|string', + 'discord-client-secret' => 'nullable|string', + 'discord-guild-id' => 'nullable|string', + 'discord-invite-url' => 'nullable|string', + 'discord-role-id' => 'nullable|string', + 'recaptcha-site-key' => 'nullable|string', + 'recaptcha-secret-key' => 'nullable|string', + 'enable-recaptcha' => 'nullable|string', + 'mailservice' => 'nullable|string', + 'mailhost' => 'nullable|string', + 'mailport' => 'nullable|string', + 'mailusername' => 'nullable|string', + 'mailpassword' => 'nullable|string', + 'mailencryption' => 'nullable|string', + 'mailfromadress' => 'nullable|string', + 'mailfromname' => 'nullable|string', + ]); + + if ($validator->fails()) { + return redirect(route('admin.settings.index') . '#misc')->with('error', __('Misc settings have not been updated!'))->withErrors($validator) + ->withInput(); + } + + if ($request->hasFile('icon')) { + $request->file('icon')->storeAs('public', 'icon.png'); + } + if ($request->hasFile('favicon')) { + $request->file('favicon')->storeAs('public', 'favicon.ico'); + } + + $values = [ + "SETTINGS::DISCORD:BOT_TOKEN" => "discord-bot-token", + "SETTINGS::DISCORD:CLIENT_ID" => "discord-client-id", + "SETTINGS::DISCORD:CLIENT_SECRET" => "discord-client-secret", + "SETTINGS::DISCORD:GUILD_ID" => "discord-guild-id", + "SETTINGS::DISCORD:INVITE_URL" => "discord-invite-url", + "SETTINGS::DISCORD:ROLE_ID" => "discord-role-id", + "SETTINGS::RECAPTCHA:SITE_KEY" => "recaptcha-site-key", + "SETTINGS::RECAPTCHA:SECRET_KEY" => "recaptcha-secret-key", + "SETTINGS::RECAPTCHA:ENABLED" => "enable-recaptcha", + "SETTINGS::MAIL:MAILER" => "mailservice", + "SETTINGS::MAIL:HOST" => "mailhost", + "SETTINGS::MAIL:PORT" => "mailport", + "SETTINGS::MAIL:USERNAME" => "mailusername", + "SETTINGS::MAIL:PASSWORD" => "mailpassword", + "SETTINGS::MAIL:ENCRYPTION" => "mailencryption", + "SETTINGS::MAIL:FROM_ADDRESS" => "mailfromadress", + "SETTINGS::MAIL:FROM_NAME" => "mailfromname", + + ]; + + foreach ($values as $key => $value) { + $param = $request->get($value); + + Settings::where('key', $key)->updateOrCreate(['key' => $key], ['value' => $param]); + Cache::forget("setting" . ':' . $key); + } + + + return redirect(route('admin.settings.index') . '#misc')->with('success', __('Misc settings updated!')); + } +} diff --git a/app/Classes/Settings/Payments.php b/app/Classes/Settings/Payments.php new file mode 100644 index 00000000..262e2886 --- /dev/null +++ b/app/Classes/Settings/Payments.php @@ -0,0 +1,61 @@ +all(), [ + "paypal-client_id" => "nullable|string", + "paypal-client-secret" => "nullable|string", + "paypal-sandbox-secret" => "nullable|string", + "stripe-secret-key" => "nullable|string", + "stripe-endpoint-secret" => "nullable|string", + "stripe-test-secret-key" => "nullable|string", + "stripe-test-endpoint-secret" => "nullable|string", + "stripe-methods" => "nullable|string", + "sales-tax" => "nullable|numeric", + ]); + if ($validator->fails()) { + return redirect(route('admin.settings.index') . '#payment')->with('error', __('Payment settings have not been updated!'))->withErrors($validator) + ->withInput(); + } + + $values = [ + //SETTINGS::VALUE => REQUEST-VALUE (coming from the html-form) + "SETTINGS::PAYMENTS:PAYPAL:SECRET" => "paypal-client-secret", + "SETTINGS::PAYMENTS:PAYPAL:CLIENT_ID" => "paypal-client-id", + "SETTINGS::PAYMENTS:PAYPAL:SANDBOX_SECRET" => "paypal-sandbox-secret", + "SETTINGS::PAYMENTS:PAYPAL:SANDBOX_CLIENT_ID" => "paypal-sandbox-id", + "SETTINGS::PAYMENTS:STRIPE:SECRET" => "stripe-secret", + "SETTINGS::PAYMENTS:STRIPE:ENDPOINT_SECRET" => "stripe-endpoint-secret", + "SETTINGS::PAYMENTS:STRIPE:TEST_SECRET" => "stripe-test-secret", + "SETTINGS::PAYMENTS:STRIPE:ENDPOINT_TEST_SECRET" => "stripe-endpoint-test-secret", + "SETTINGS::PAYMENTS:STRIPE:METHODS" => "stripe-methods", + "SETTINGS::PAYMENTS:SALES_TAX" => "sales-tax" + ]; + + + foreach ($values as $key => $value) { + $param = $request->get($value); + + Settings::where('key', $key)->updateOrCreate(['key' => $key], ['value' => $param]); + Cache::forget("setting" . ':' . $key); + } + + return redirect(route('admin.settings.index') . '#payment')->with('success', __('Payment settings updated!')); + } +} diff --git a/app/Classes/Settings/System.php b/app/Classes/Settings/System.php new file mode 100644 index 00000000..a9e32b08 --- /dev/null +++ b/app/Classes/Settings/System.php @@ -0,0 +1,73 @@ +all(), [ + "register-ip-check" => "string", + "server-create-charge-first-hour" => "string", + "credits-display-name" => "required|string", + "allocation-limit" => "required|min:0|integer", + "force-email-verification" => "string", + "force-discord-verification" => "string", + "initial-credits" => "required|min:0|integer", + "initial-server-limit" => "required|min:0|integer", + "credits-reward-amount-discord" => "required|min:0|integer", + "credits-reward-amount-email" => "required|min:0|integer", + "server-limit-discord" => "required|min:0|integer", + "server-limit-email" => "required|min:0|integer", + "pterodactyl-api-key" => "required|string", + "pterodactyl-url" => "required|string", + + ]); + if ($validator->fails()) { + return redirect(route('admin.settings.index') . '#system')->with('error', __('System settings have not been updated!'))->withErrors($validator) + ->withInput(); + } + + + $values = [ + "SETTINGS::SYSTEM:REGISTER_IP_CHECK" => "register-ip-check", + "SETTINGS::SYSTEM:SERVER_CREATE_CHARGE_FIRST_HOUR" => "server-create-charge-first-hour", + "SETTINGS::SYSTEM:CREDITS_DISPLAY_NAME" => "credits-display-name", + "SETTINGS::SERVER:ALLOCATION_LIMIT" => "allocation-limit", + "SETTINGS::USER:FORCE_DISCORD_VERIFICATION" => "force-discord-verification", + "SETTINGS::USER:FORCE_EMAIL_VERIFICATION" => "force-email-verification", + "SETTINGS::USER:INITIAL_CREDITS" => "initial-credits", + "SETTINGS::USER:INITIAL_SERVER_LIMIT" => "initial-server-limit", + "SETTINGS::USER:CREDITS_REWARD_AFTER_VERIFY_DISCORD" => "credits-reward-amount-discord", + "SETTINGS::USER:CREDITS_REWARD_AFTER_VERIFY_EMAIL" => "credits-reward-amount-email", + "SETTINGS::USER:SERVER_LIMIT_REWARD_AFTER_VERIFY_DISCORD" => "server-limit-discord", + "SETTINGS::USER:SERVER_LIMIT_REWARD_AFTER_VERIFY_EMAIL" => "server-limit-email", + "SETTINGS::MISC:PHPMYADMIN:URL" => "phpmyadmin-url", + "SETTINGS::SYSTEM:PTERODACTYL:URL" => "pterodactyl-url", + "SETTINGS::SYSTEM:PTERODACTYL:TOKEN" => "pterodactyl-api-key", + ]; + + + foreach ($values as $key => $value) { + $param = $request->get($value); + + Settings::where('key', $key)->updateOrCreate(['key' => $key], ['value' => $param]); + Cache::forget("setting" . ':' . $key); + } + return redirect(route('admin.settings.index') . '#system')->with('success', __('System settings updated!')); + } +} diff --git a/app/Http/Controllers/Admin/ConfigurationController.php b/app/Http/Controllers/Admin/ConfigurationController.php deleted file mode 100644 index f10dc3e8..00000000 --- a/app/Http/Controllers/Admin/ConfigurationController.php +++ /dev/null @@ -1,123 +0,0 @@ -input('key')); - - $request->validate([ - 'key' => 'required|string|max:191', - 'value' => 'required|string|max:191', - ]); - - $configuration->update($request->all()); - - return redirect()->route('admin.configurations.index')->with('success', __('configuration has been updated!')); - } - - /** - * Remove the specified resource from storage. - * - * @param Configuration $configuration - * @return Response - */ - public function destroy(Configuration $configuration) - { - // - } - - public function datatable() - { - $query = Configuration::query(); - - return datatables($query) - ->addColumn('actions', function (Configuration $configuration) { - return ' '; - }) - ->editColumn('created_at', function (Configuration $configuration) { - return $configuration->created_at ? $configuration->created_at->diffForHumans() : ''; - }) - ->rawColumns(['actions']) - ->make(); - } -} diff --git a/app/Http/Controllers/Admin/CreditProductController.php b/app/Http/Controllers/Admin/CreditProductController.php index d85297fe..268811d8 100644 --- a/app/Http/Controllers/Admin/CreditProductController.php +++ b/app/Http/Controllers/Admin/CreditProductController.php @@ -3,6 +3,7 @@ namespace App\Http\Controllers\Admin; use App\Models\CreditProduct; +use App\Models\Settings; use Illuminate\Contracts\Foundation\Application; use Illuminate\Contracts\View\Factory; use Illuminate\Contracts\View\View; @@ -25,8 +26,8 @@ class CreditProductController extends Controller if ( env('APP_ENV') == 'local' || - env('PAYPAL_SECRET') && env('PAYPAL_CLIENT_ID') || - env('STRIPE_SECRET') && env('STRIPE_ENDPOINT_SECRET') && env('STRIPE_METHODS') + Settings::getValueByKey("SETTINGS::PAYMENTS:PAYPAL:SECRET") && Settings::getValueByKey("SETTINGS::PAYMENTS:PAYPAL:CLIENT_ID") || + Settings::getValueByKey("SETTINGS::PAYMENTS:STRIPE:SECRET") && Settings::getValueByKey("SETTINGS::PAYMENTS:STRIPE:ENDPOINT_SECRET") && Settings::getValueByKey("SETTINGS::PAYMENTS:STRIPE:METHODS") ) $isPaymentSetup = true; return view('admin.store.index', [ diff --git a/app/Http/Controllers/Admin/InvoiceController.php b/app/Http/Controllers/Admin/InvoiceController.php new file mode 100644 index 00000000..381d7385 --- /dev/null +++ b/app/Http/Controllers/Admin/InvoiceController.php @@ -0,0 +1,70 @@ +open($zip_safe_path, ZipArchive::CREATE | ZipArchive::OVERWRITE); + $result = $dthis::rglob(storage_path('app/invoice/*')); + if ($res === TRUE) { + $zip->addFromString("1. Info.txt", __("Created at") . " " . now()->format("d.m.Y")); + foreach ($result as $file) { + if (file_exists($file) && is_file($file)) { + $zip->addFile($file, basename($file)); + } + } + $zip->close(); + } + return response()->download($zip_safe_path); + } + + /** + * @param $pattern + * @param $flags + * @return array|false + */ + public function rglob($pattern, $flags = 0) + { + $files = glob($pattern, $flags); + foreach (glob(dirname($pattern) . '/*', GLOB_ONLYDIR | GLOB_NOSORT) as $dir) { + $files = array_merge($files, $this::rglob($dir . '/' . basename($pattern), $flags)); + } + return $files; + } + + /** + * @param $paymentID + * @param $date + */ + public function downloadSingleInvoice(Request $request) + { + $id = $request->id; + try { + $query = Invoice::where('payment_id', '=', $id)->firstOrFail(); + } catch (Throwable $e) { + return redirect()->back()->with("error", __("Error!")); + } + + $invoice_path = storage_path('app/invoice/' . $query->invoice_user . '/' . $query->created_at->format("Y") . '/' . $query->invoice_name . '.pdf'); + + if (!file_exists($invoice_path)) { + return redirect()->back()->with("error", __("Error!")); + } + + + return response()->download($invoice_path); + + } + +} diff --git a/app/Http/Controllers/Admin/PaymentController.php b/app/Http/Controllers/Admin/PaymentController.php index b7d7b193..3b2a8ad9 100644 --- a/app/Http/Controllers/Admin/PaymentController.php +++ b/app/Http/Controllers/Admin/PaymentController.php @@ -4,10 +4,10 @@ namespace App\Http\Controllers\Admin; use App\Events\UserUpdateCreditsEvent; use App\Http\Controllers\Controller; -use App\Models\Configuration; use App\Models\InvoiceSettings; use App\Models\Payment; use App\Models\CreditProduct; +use App\Models\Settings; use App\Models\User; use App\Notifications\InvoiceNotification; use App\Notifications\ConfirmPaymentNotification; @@ -134,7 +134,7 @@ class PaymentController extends Controller */ protected function getPaypalClientId() { - return env('APP_ENV') == 'local' ? env('PAYPAL_SANDBOX_CLIENT_ID') : env('PAYPAL_CLIENT_ID'); + return env('APP_ENV') == 'local' ? Settings::getValueByKey("SETTINGS::PAYMENTS:PAYPAL:SANDBOX_CLIENT_ID") : Settings::getValueByKey("SETTINGS::PAYMENTS:PAYPAL:CLIENT_ID"); } /** @@ -142,7 +142,7 @@ class PaymentController extends Controller */ protected function getPaypalClientSecret() { - return env('APP_ENV') == 'local' ? env('PAYPAL_SANDBOX_SECRET') : env('PAYPAL_SECRET'); + return env('APP_ENV') == 'local' ? Settings::getValueByKey("SETTINGS::PAYMENTS:PAYPAL:SANDBOX_SECRET") : Settings::getValueByKey("SETTINGS::PAYMENTS:PAYPAL:SECRET"); } /** @@ -167,9 +167,9 @@ class PaymentController extends Controller $user->increment('credits', $creditProduct->quantity); //update server limit - if (Configuration::getValueByKey('SERVER_LIMIT_AFTER_IRL_PURCHASE') !== 0) { - if ($user->server_limit < Configuration::getValueByKey('SERVER_LIMIT_AFTER_IRL_PURCHASE')) { - $user->update(['server_limit' => Configuration::getValueByKey('SERVER_LIMIT_AFTER_IRL_PURCHASE')]); + if (Settings::getValueByKey('SETTINGS::USER:SERVER_LIMIT_AFTER_IRL_PURCHASE') !== 0) { + if ($user->server_limit < Settings::getValueByKey('SETTINGS::USER:SERVER_LIMIT_AFTER_IRL_PURCHASE')) { + $user->update(['server_limit' => Settings::getValueByKey('SETTINGS::USER:SERVER_LIMIT_AFTER_IRL_PURCHASE')]); } } @@ -197,7 +197,11 @@ class PaymentController extends Controller event(new UserUpdateCreditsEvent($user)); - $this->createInvoice($user, $payment, 'paid'); + //only create invoice if SETTINGS::INVOICE:ENABLED is true + if (config('SETTINGS::INVOICE:ENABLED') == 'true') { + $this->createInvoice($user, $payment, 'paid'); + } + //redirect back to home return redirect()->route('home')->with('success', __('Your credit balance has been increased!')); @@ -266,7 +270,7 @@ class PaymentController extends Controller ], 'mode' => 'payment', - "payment_method_types" => str_getcsv(str_replace(' ', '', env('STRIPE_METHODS'))), + "payment_method_types" => str_getcsv(config("SETTINGS::PAYMENTS:STRIPE:METHODS")), 'success_url' => route('payment.StripeSuccess', ['product' => $creditProduct->id]) . '&session_id={CHECKOUT_SESSION_ID}', 'cancel_url' => route('payment.Cancel'), ]); @@ -304,9 +308,9 @@ class PaymentController extends Controller $user->increment('credits', $creditProduct->quantity); //update server limit - if (Configuration::getValueByKey('SERVER_LIMIT_AFTER_IRL_PURCHASE') !== 0) { - if ($user->server_limit < Configuration::getValueByKey('SERVER_LIMIT_AFTER_IRL_PURCHASE')) { - $user->update(['server_limit' => Configuration::getValueByKey('SERVER_LIMIT_AFTER_IRL_PURCHASE')]); + if (Settings::getValueByKey('SETTINGS::USER:SERVER_LIMIT_AFTER_IRL_PURCHASE') !== 0) { + if ($user->server_limit < Settings::getValueByKey('SETTINGS::USER:SERVER_LIMIT_AFTER_IRL_PURCHASE')) { + $user->update(['server_limit' => Settings::getValueByKey('SETTINGS::USER:SERVER_LIMIT_AFTER_IRL_PURCHASE')]); } } @@ -336,7 +340,10 @@ class PaymentController extends Controller event(new UserUpdateCreditsEvent($user)); - $this->createInvoice($user, $payment, 'paid'); + //only create invoice if SETTINGS::INVOICE:ENABLED is true + if (config('SETTINGS::INVOICE:ENABLED') == 'true') { + $this->createInvoice($user, $payment, 'paid'); + } //redirect back to home return redirect()->route('home')->with('success', __('Your credit balance has been increased!')); @@ -359,7 +366,10 @@ class PaymentController extends Controller 'credit_product_id' => $creditProduct->id, ]); - $this->createInvoice($user, $payment, 'processing'); + //only create invoice if SETTINGS::INVOICE:ENABLED is true + if (config('SETTINGS::INVOICE:ENABLED') == 'true') { + $this->createInvoice($user, $payment, 'paid'); + } //redirect back to home return redirect()->route('home')->with('success', __('Your payment is being processed!')); @@ -398,9 +408,9 @@ class PaymentController extends Controller $user->increment('credits', $payment->amount); //update server limit - if (Configuration::getValueByKey('SERVER_LIMIT_AFTER_IRL_PURCHASE') !== 0) { - if ($user->server_limit < Configuration::getValueByKey('SERVER_LIMIT_AFTER_IRL_PURCHASE')) { - $user->update(['server_limit' => Configuration::getValueByKey('SERVER_LIMIT_AFTER_IRL_PURCHASE')]); + if (Settings::getValueByKey('SETTINGS::USER:SERVER_LIMIT_AFTER_IRL_PURCHASE') !== 0) { + if ($user->server_limit < Settings::getValueByKey('SETTINGS::USER:SERVER_LIMIT_AFTER_IRL_PURCHASE')) { + $user->update(['server_limit' => Settings::getValueByKey('SETTINGS::USER:SERVER_LIMIT_AFTER_IRL_PURCHASE')]); } } @@ -416,7 +426,10 @@ class PaymentController extends Controller $user->notify(new ConfirmPaymentNotification($payment)); event(new UserUpdateCreditsEvent($user)); - $this->createInvoice($user, $payment, 'paid'); + //only create invoice if SETTINGS::INVOICE:ENABLED is true + if (config('SETTINGS::INVOICE:ENABLED') == 'true') { + $this->createInvoice($user, $payment, 'paid'); + } } } catch (HttpException $ex) { abort(422); @@ -474,8 +487,8 @@ class PaymentController extends Controller protected function getStripeSecret() { return env('APP_ENV') == 'local' - ? env('STRIPE_TEST_SECRET') - : env('STRIPE_SECRET'); + ? Settings::getValueByKey("SETTINGS::PAYMENTS:STRIPE:TEST_SECRET") + : Settings::getValueByKey("SETTINGS::PAYMENTS:STRIPE:SECRET"); } /** @@ -484,8 +497,8 @@ class PaymentController extends Controller protected function getStripeEndpointSecret() { return env('APP_ENV') == 'local' - ? env('STRIPE_ENDPOINT_TEST_SECRET') - : env('STRIPE_ENDPOINT_SECRET'); + ? Settings::getValueByKey("SETTINGS::PAYMENTS:STRIPE:ENDPOINT_TEST_SECRET") + : Settings::getValueByKey("SETTINGS::PAYMENTS:STRIPE:ENDPOINT_SECRET"); } @@ -495,17 +508,16 @@ class PaymentController extends Controller //create invoice $lastInvoiceID = \App\Models\Invoice::where("invoice_name", "like", "%" . now()->format('mY') . "%")->count("id"); $newInvoiceID = $lastInvoiceID + 1; - $InvoiceSettings = InvoiceSettings::query()->first(); $logoPath = storage_path('app/public/logo.png'); $seller = new Party([ - 'name' => $InvoiceSettings->company_name, - 'phone' => $InvoiceSettings->company_phone, - 'address' => $InvoiceSettings->company_adress, - 'vat' => $InvoiceSettings->company_vat, + 'name' => Settings::getValueByKey("SETTINGS::INVOICE:COMPANY_NAME"), + 'phone' => Settings::getValueByKey("SETTINGS::INVOICE:COMPANY_PHONE"), + 'address' => Settings::getValueByKey("SETTINGS::INVOICE:COMPANY_ADDRESS"), + 'vat' => Settings::getValueByKey("SETTINGS::INVOICE:COMPANY_VAT"), 'custom_fields' => [ - 'E-Mail' => $InvoiceSettings->company_mail, - "Web" => $InvoiceSettings->company_web + 'E-Mail' => Settings::getValueByKey("SETTINGS::INVOICE:COMPANY_MAIL"), + "Web" => Settings::getValueByKey("SETTINGS::INVOICE:COMPANY_WEBSITE") ], ]); @@ -540,7 +552,7 @@ class PaymentController extends Controller ->series(now()->format('mY')) ->delimiter("-") ->sequence($newInvoiceID) - ->serialNumberFormat($InvoiceSettings->invoice_prefix . '{DELIMITER}{SERIES}{SEQUENCE}') + ->serialNumberFormat(Settings::getValueByKey("SETTINGS::INVOICE:PREFIX") . '{DELIMITER}{SERIES}{SEQUENCE}') ->notes($notes); if (file_exists($logoPath)) { @@ -591,6 +603,11 @@ class PaymentController extends Controller ->editColumn('created_at', function (Payment $payment) { return $payment->created_at ? $payment->created_at->diffForHumans() : ''; }) - ->make(); + ->addColumn('actions', function (Payment $payment) { + return ' +'; + }) + ->rawColumns(['actions']) + ->make(true); } } diff --git a/app/Http/Controllers/Admin/ProductController.php b/app/Http/Controllers/Admin/ProductController.php index bf32069f..6386fe0a 100644 --- a/app/Http/Controllers/Admin/ProductController.php +++ b/app/Http/Controllers/Admin/ProductController.php @@ -3,12 +3,10 @@ namespace App\Http\Controllers\Admin; use App\Http\Controllers\Controller; -use App\Models\Egg; use App\Models\Location; use App\Models\Nest; -use App\Models\Node; -use App\Models\Configuration; use App\Models\Product; +use App\Models\Settings; use Exception; use Illuminate\Contracts\Foundation\Application; use Illuminate\Contracts\View\Factory; @@ -16,7 +14,6 @@ use Illuminate\Contracts\View\View; use Illuminate\Http\JsonResponse; use Illuminate\Http\RedirectResponse; use Illuminate\Http\Request; -use Illuminate\Http\Response; class ProductController extends Controller { @@ -97,7 +94,7 @@ class ProductController extends Controller { return view('admin.products.show', [ 'product' => $product, - 'minimum_credits' => Configuration::getValueByKey("MINIMUM_REQUIRED_CREDITS_TO_MAKE_SERVER"), + 'minimum_credits' => Settings::getValueByKey("SETTINGS::USER:MINIMUM_REQUIRED_CREDITS_TO_MAKE_SERVER"), ]); } diff --git a/app/Http/Controllers/Admin/ServerController.php b/app/Http/Controllers/Admin/ServerController.php index 2211be38..3006de94 100644 --- a/app/Http/Controllers/Admin/ServerController.php +++ b/app/Http/Controllers/Admin/ServerController.php @@ -6,6 +6,7 @@ use App\Classes\Pterodactyl; use App\Classes\PterodactylWrapper; use App\Http\Controllers\Controller; use App\Models\Server; +use App\Models\Settings; use Exception; use Illuminate\Contracts\Foundation\Application; use Illuminate\Contracts\View\Factory; @@ -161,7 +162,7 @@ class ServerController extends Controller return $server->suspended ? $server->suspended->diffForHumans() : ''; }) ->editColumn('name', function (Server $server) { - return '' . $server->name . ''; + return 'pterodactyl_id . '">' . $server->name . ''; }) ->rawColumns(['user', 'actions', 'status', 'name']) ->make(); diff --git a/app/Http/Controllers/Admin/SettingsController.php b/app/Http/Controllers/Admin/SettingsController.php index aeabd3d5..f4b8b4ee 100644 --- a/app/Http/Controllers/Admin/SettingsController.php +++ b/app/Http/Controllers/Admin/SettingsController.php @@ -3,13 +3,12 @@ namespace App\Http\Controllers\Admin; use App\Http\Controllers\Controller; -use App\Models\InvoiceSettings; +use App\Models\Settings; use Illuminate\Contracts\Foundation\Application; use Illuminate\Contracts\View\Factory; use Illuminate\Contracts\View\View; use Illuminate\Http\Request; use Illuminate\Http\Response; -use ZipArchive; class SettingsController extends Controller { @@ -20,81 +19,68 @@ class SettingsController extends Controller */ public function index() { - /** @var InvoiceSettings $invoiceSettings */ - $invoiceSettings = InvoiceSettings::first(); + //Get all tabs as laravel view paths + $tabs = []; + foreach (glob(resource_path('views/admin/settings/tabs/*.blade.php')) as $filename) { + $tabs[] = 'admin.settings.tabs.' . basename($filename, '.blade.php'); + } - return view('admin.settings.index', $invoiceSettings->toArray()); + //Generate a html list item for each tab based on tabs file basename, set first tab as active + $tabListItems = []; + foreach ($tabs as $tab) { + $tabName = str_replace('admin.settings.tabs.', '', $tab); + $tabListItems[] = ''; + } + + return view('admin.settings.index', [ + 'tabs' => $tabs, + 'tabListItems' => $tabListItems, + ]); } - public function updateIcons(Request $request) + + public function updatevalue(Request $request) { + $setting = Settings::findOrFail($request->input('key')); + $request->validate([ - 'icon' => 'nullable|max:10000|mimes:jpg,png,jpeg', - 'favicon' => 'nullable|max:10000|mimes:ico', + 'key' => 'required|string|max:191', + 'value' => 'required|string|max:191', ]); - if ($request->hasFile('icon')) { - $request->file('icon')->storeAs('public', 'icon.png'); - } + $setting->update($request->all()); - if ($request->hasFile('favicon')) { - $request->file('favicon')->storeAs('public', 'favicon.ico'); - } - - return redirect()->route('admin.settings.index')->with('success', __('Icons updated!')); + return redirect()->route('admin.settings.index')->with('success', __('configuration has been updated!')); } - public function updateInvoiceSettings(Request $request) + /** + * Remove the specified resource from storage. + * + * @param Settings $setting + * @return Response + */ + public function destroy(Settings $setting) { - $request->validate([ - 'logo' => 'nullable|max:10000|mimes:jpg,png,jpeg', - ]); - - InvoiceSettings::updateOrCreate([ - 'id' => "1" - ], [ - 'company_name' => $request->get('company-name'), - 'company_adress' => $request->get('company-address'), - 'company_phone' => $request->get('company-phone'), - 'company_mail' => $request->get('company-mail'), - 'company_vat' => $request->get('company-vat'), - 'company_web' => $request->get('company-web'), - 'invoice_prefix' => $request->get('invoice-prefix'), - ]); - - if ($request->hasFile('logo')) { - $request->file('logo')->storeAs('public', 'logo.png'); - } - - - return redirect()->route('admin.settings.index')->with('success', 'Invoice settings updated!'); + // } - public function downloadAllInvoices() + public function datatable() { - $zip = new ZipArchive; - $zip_safe_path = storage_path('invoices.zip'); - $res = $zip->open($zip_safe_path, ZipArchive::CREATE | ZipArchive::OVERWRITE); - $result = $this::rglob(storage_path('app/invoice/*')); - if ($res === TRUE) { - $zip->addFromString("1. Info.txt", "This Archive contains all Invoices from all Users!\nIf there are no Invoices here, no Invoices have ever been created!"); - foreach ($result as $file) { - if (file_exists($file) && is_file($file)) { - $zip->addFile($file, basename($file)); - } - } - $zip->close(); - } - return response()->download($zip_safe_path); - } + $query = Settings::where('key', 'like', '%SYSTEM%') + ->orWhere('key', 'like', '%USER%') + ->orWhere('key', 'like', '%SERVER%'); - public function rglob($pattern, $flags = 0) - { - $files = glob($pattern, $flags); - foreach (glob(dirname($pattern) . '/*', GLOB_ONLYDIR | GLOB_NOSORT) as $dir) { - $files = array_merge($files, $this::rglob($dir . '/' . basename($pattern), $flags)); - } - return $files; + return datatables($query) + ->addColumn('actions', function (Settings $setting) { + return ' '; + }) + ->editColumn('created_at', function (Settings $setting) { + return $setting->created_at ? $setting->created_at->diffForHumans() : ''; + }) + ->rawColumns(['actions']) + ->make(); } - } diff --git a/app/Http/Controllers/Admin/UserController.php b/app/Http/Controllers/Admin/UserController.php index eb36fa38..c0940cd7 100644 --- a/app/Http/Controllers/Admin/UserController.php +++ b/app/Http/Controllers/Admin/UserController.php @@ -5,6 +5,7 @@ namespace App\Http\Controllers\Admin; use App\Classes\Pterodactyl; use App\Events\UserUpdateCreditsEvent; use App\Http\Controllers\Controller; +use App\Models\Settings; use App\Models\User; use App\Notifications\DynamicNotification; use Spatie\QueryBuilder\QueryBuilder; @@ -300,7 +301,7 @@ class UserController extends Controller return '' . $user->role . ''; }) ->editColumn('name', function (User $user) { - return '' . $user->name . ''; + return 'pterodactyl_id . '">' . $user->name . ''; }) ->orderColumn('last_seen', function ($query, $order) { $query->orderBy('last_seen', $order); diff --git a/app/Http/Controllers/Api/UserController.php b/app/Http/Controllers/Api/UserController.php index 47693c48..b2b6c921 100644 --- a/app/Http/Controllers/Api/UserController.php +++ b/app/Http/Controllers/Api/UserController.php @@ -5,8 +5,8 @@ namespace App\Http\Controllers\Api; use App\Classes\Pterodactyl; use App\Events\UserUpdateCreditsEvent; use App\Http\Controllers\Controller; -use App\Models\Configuration; use App\Models\DiscordUser; +use App\Models\Settings; use App\Models\User; use Illuminate\Contracts\Foundation\Application; use Illuminate\Contracts\Pagination\LengthAwarePaginator; @@ -242,8 +242,8 @@ class UserController extends Controller $user = User::create([ 'name' => $request->input('name'), 'email' => $request->input('email'), - 'credits' => Configuration::getValueByKey('INITIAL_CREDITS', 150), - 'server_limit' => Configuration::getValueByKey('INITIAL_SERVER_LIMIT', 1), + 'credits' => Settings::getValueByKey('SETTINGS::USER:INITIAL_CREDITS', 150), + 'server_limit' => Settings::getValueByKey('SETTINGS::USER:INITIAL_SERVER_LIMIT', 1), 'password' => Hash::make($request->input('password')), ]); diff --git a/app/Http/Controllers/Auth/LoginController.php b/app/Http/Controllers/Auth/LoginController.php index d80fb5bf..a9429689 100644 --- a/app/Http/Controllers/Auth/LoginController.php +++ b/app/Http/Controllers/Auth/LoginController.php @@ -41,17 +41,25 @@ class LoginController extends Controller public function login(Request $request) { - $request->validate([ + + $validationRules = [ $this->username() => 'required|string', 'password' => 'required|string', - 'g-recaptcha-response' => ['required','recaptcha'], - ]); + ]; + if (config('SETTINGS::RECAPTCHA:ENABLED') == 'true') { + $validationRules['g-recaptcha-response'] = ['required', 'recaptcha']; + } + $request->validate($validationRules); + + // If the class is using the ThrottlesLogins trait, we can automatically throttle // the login attempts for this application. We'll key this by the username and // the IP address of the client making these requests into this application. - if (method_exists($this, 'hasTooManyLoginAttempts') && - $this->hasTooManyLoginAttempts($request)) { + if ( + method_exists($this, 'hasTooManyLoginAttempts') && + $this->hasTooManyLoginAttempts($request) + ) { $this->fireLockoutEvent($request); return $this->sendLockoutResponse($request); diff --git a/app/Http/Controllers/Auth/RegisterController.php b/app/Http/Controllers/Auth/RegisterController.php index 34bc79e0..c4c3ba2a 100644 --- a/app/Http/Controllers/Auth/RegisterController.php +++ b/app/Http/Controllers/Auth/RegisterController.php @@ -4,7 +4,7 @@ namespace App\Http\Controllers\Auth; use App\Classes\Pterodactyl; use App\Http\Controllers\Controller; -use App\Models\Configuration; +use App\Models\Settings; use App\Models\User; use App\Providers\RouteServiceProvider; use Illuminate\Foundation\Auth\RegistersUsers; @@ -54,30 +54,28 @@ class RegisterController extends Controller */ protected function validator(array $data) { - if (Configuration::getValueByKey('REGISTER_IP_CHECK', 'true') == 'true') { + $validationRules = [ + 'name' => ['required', 'string', 'max:30', 'min:4', 'alpha_num', 'unique:users'], + 'email' => ['required', 'string', 'email', 'max:64', 'unique:users'], + 'password' => ['required', 'string', 'min:8', 'confirmed'], + ]; + if (config('SETTINGS::RECAPTCHA:ENABLED') == 'true') { + $validationRules['g-recaptcha-response'] = ['required', 'recaptcha']; + } + + if (config('SETTINGS::SYSTEM:REGISTER_IP_CHECK', 'true') == 'true') { //check if ip has already made an account $data['ip'] = session()->get('ip') ?? request()->ip(); if (User::where('ip', '=', request()->ip())->exists()) session()->put('ip', request()->ip()); + $validationRules['ip'] = ['unique:users']; + return Validator::make($data, $validationRules, [ + 'ip.unique' => "You have already made an account! Please contact support if you think this is incorrect." - return Validator::make($data, [ - 'name' => ['required', 'string', 'max:30', 'min:4', 'alpha_num', 'unique:users'], - 'email' => ['required', 'string', 'email', 'max:64', 'unique:users'], - 'password' => ['required', 'string', 'min:8', 'confirmed'], - 'g-recaptcha-response' => ['recaptcha'], - 'ip' => ['unique:users'], - ], [ - 'ip.unique' => __("You have already made an account with us! Please contact support if you think this is incorrect.") ]); } - return Validator::make($data, [ - 'name' => ['required', 'string', 'max:30', 'min:4', 'alpha_num', 'unique:users'], - 'email' => ['required', 'string', 'email', 'max:64', 'unique:users'], - 'password' => ['required', 'string', 'min:8', 'confirmed'], - 'g-recaptcha-response' => ['recaptcha'], - ]); - + return Validator::make($data, $validationRules); } /** @@ -91,8 +89,8 @@ class RegisterController extends Controller $user = User::create([ 'name' => $data['name'], 'email' => $data['email'], - 'credits' => Configuration::getValueByKey('INITIAL_CREDITS', 150), - 'server_limit' => Configuration::getValueByKey('INITIAL_SERVER_LIMIT', 1), + 'credits' => config('SETTINGS::USER:INITIAL_CREDITS', 150), + 'server_limit' => config('SETTINGS::USER:INITIAL_SERVER_LIMIT', 1), 'password' => Hash::make($data['password']), ]); diff --git a/app/Http/Controllers/Auth/SocialiteController.php b/app/Http/Controllers/Auth/SocialiteController.php index aa8b93c2..04b6f203 100644 --- a/app/Http/Controllers/Auth/SocialiteController.php +++ b/app/Http/Controllers/Auth/SocialiteController.php @@ -3,8 +3,8 @@ namespace App\Http\Controllers\Auth; use App\Http\Controllers\Controller; -use App\Models\Configuration; use App\Models\DiscordUser; +use App\Models\Settings; use App\Models\User; use App\Models\Voucher; use Illuminate\Support\Facades\Auth; @@ -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,17 +31,17 @@ 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)) { //create discord user in db DiscordUser::create(array_merge($discord->user, ['user_id' => Auth::user()->id])); //update user - Auth::user()->increment('credits', Configuration::getValueByKey('CREDITS_REWARD_AFTER_VERIFY_DISCORD')); - Auth::user()->increment('server_limit', Configuration::getValueByKey('SERVER_LIMIT_REWARD_AFTER_VERIFY_DISCORD')); + Auth::user()->increment('credits', Settings::getValueByKey('SETTINGS::USER:CREDITS_REWARD_AFTER_VERIFY_DISCORD')); + Auth::user()->increment('server_limit', Settings::getValueByKey('SETTINGS::USER:SERVER_LIMIT_REWARD_AFTER_VERIFY_DISCORD')); Auth::user()->update(['discord_verified_at' => now()]); } else { $user->discordUser->update($discord->user); diff --git a/app/Http/Controllers/HomeController.php b/app/Http/Controllers/HomeController.php index 646293ac..d6b2fd18 100644 --- a/app/Http/Controllers/HomeController.php +++ b/app/Http/Controllers/HomeController.php @@ -2,10 +2,7 @@ namespace App\Http\Controllers; -use App\Models\Egg; -use App\Models\Product; use App\Models\UsefulLink; -use App\Models\Configuration; use Illuminate\Http\Request; use Illuminate\Support\Facades\Auth; diff --git a/app/Http/Controllers/ProfileController.php b/app/Http/Controllers/ProfileController.php index 50f19d1e..57709b62 100644 --- a/app/Http/Controllers/ProfileController.php +++ b/app/Http/Controllers/ProfileController.php @@ -2,14 +2,11 @@ namespace App\Http\Controllers; + use App\Classes\Pterodactyl; -use App\Models\Configuration; use App\Models\User; -use Illuminate\Contracts\View\Factory; -use Illuminate\Contracts\View\View; use Illuminate\Http\RedirectResponse; use Illuminate\Http\Request; -use Illuminate\Http\Response; use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Hash; use Illuminate\Validation\ValidationException; @@ -21,9 +18,9 @@ class ProfileController extends Controller { return view('profile.index')->with([ 'user' => Auth::user(), - 'credits_reward_after_verify_discord' => Configuration::getValueByKey('CREDITS_REWARD_AFTER_VERIFY_DISCORD'), - 'force_email_verification' => Configuration::getValueByKey('FORCE_EMAIL_VERIFICATION'), - 'force_discord_verification' => Configuration::getValueByKey('FORCE_DISCORD_VERIFICATION'), + 'credits_reward_after_verify_discord' => config('SETTINGS::USER:CREDITS_REWARD_AFTER_VERIFY_DISCORD'), + 'force_email_verification' => config('SETTINGS::USER:FORCE_EMAIL_VERIFICATION'), + 'force_discord_verification' => config('SETTINGS::USER:FORCE_DISCORD_VERIFICATION'), ]); } @@ -39,15 +36,15 @@ class ProfileController extends Controller $user = User::findOrFail($id); //update password if necessary - if (!is_null($request->input('new_password'))){ + if (!is_null($request->input('new_password'))) { //validate password request $request->validate([ 'current_password' => [ - 'required' , + 'required', function ($attribute, $value, $fail) use ($user) { if (!Hash::check($value, $user->password)) { - $fail('The '.$attribute.' is invalid.'); + $fail('The ' . $attribute . ' is invalid.'); } }, ], @@ -80,13 +77,13 @@ class ProfileController extends Controller //validate request $request->validate([ - 'name' => 'required|min:4|max:30|alpha_num|unique:users,name,'.$id.',id', - 'email' => 'required|email|max:64|unique:users,email,'.$id.',id', + 'name' => 'required|min:4|max:30|alpha_num|unique:users,name,' . $id . ',id', + 'email' => 'required|email|max:64|unique:users,email,' . $id . ',id', 'avatar' => 'nullable' ]); //update avatar - if(!is_null($request->input('avatar'))){ + if (!is_null($request->input('avatar'))) { $avatar = json_decode($request->input('avatar')); if ($avatar->input->size > 3000000) abort(500); @@ -121,6 +118,6 @@ class ProfileController extends Controller ]); $user->sendEmailVerificationNotification(); - return redirect()->route('profile.index')->with('success' , __('Profile updated')); + return redirect()->route('profile.index')->with('success', __('Profile updated')); } } diff --git a/app/Http/Controllers/ServerController.php b/app/Http/Controllers/ServerController.php index ff096502..c1c0a33a 100644 --- a/app/Http/Controllers/ServerController.php +++ b/app/Http/Controllers/ServerController.php @@ -3,13 +3,13 @@ namespace App\Http\Controllers; use App\Classes\Pterodactyl; -use App\Models\Configuration; use App\Models\Egg; use App\Models\Location; use App\Models\Nest; use App\Models\Node; use App\Models\Product; use App\Models\Server; +use App\Models\Settings; use App\Notifications\ServerCreationError; use Exception; use Illuminate\Database\Eloquent\Builder; @@ -107,7 +107,7 @@ class ServerController extends Controller if ( Auth::user()->credits < ($product->minimum_credits == -1 - ? Configuration::getValueByKey('MINIMUM_REQUIRED_CREDITS_TO_MAKE_SERVER', 50) + ? config('SETTINGS::USER:MINIMUM_REQUIRED_CREDITS_TO_MAKE_SERVER', 50) : $product->minimum_credits) ) { return redirect()->route('servers.index')->with('error', "You do not have the required amount of " . CREDITS_DISPLAY_NAME . " to use this product!"); @@ -115,12 +115,12 @@ class ServerController extends Controller } //Required Verification for creating an server - if (Configuration::getValueByKey('FORCE_EMAIL_VERIFICATION', 'false') === 'true' && !Auth::user()->hasVerifiedEmail()) { + if (config('SETTINGS::USER:FORCE_EMAIL_VERIFICATION', 'false') === 'true' && !Auth::user()->hasVerifiedEmail()) { return redirect()->route('profile.index')->with('error', __("You are required to verify your email address before you can create a server.")); } //Required Verification for creating an server - if (Configuration::getValueByKey('FORCE_DISCORD_VERIFICATION', 'false') === 'true' && !Auth::user()->discordUser) { + if (config('SETTINGS::USER:FORCE_DISCORD_VERIFICATION', 'false') === 'true' && !Auth::user()->discordUser) { return redirect()->route('profile.index')->with('error', __("You are required to link your discord account before you can create a server.")); } @@ -168,7 +168,7 @@ class ServerController extends Controller 'identifier' => $serverAttributes['identifier'] ]); - if (Configuration::getValueByKey('SERVER_CREATE_CHARGE_FIRST_HOUR', 'true') == 'true') { + if (config('SETTINGS::SYSTEM:SERVER_CREATE_CHARGE_FIRST_HOUR', 'true') == 'true') { if ($request->user()->credits >= $server->product->getHourlyPrice()) { $request->user()->decrement('credits', $server->product->getHourlyPrice()); } diff --git a/app/Http/Controllers/StoreController.php b/app/Http/Controllers/StoreController.php index c2ce00e8..db692bfb 100644 --- a/app/Http/Controllers/StoreController.php +++ b/app/Http/Controllers/StoreController.php @@ -2,8 +2,8 @@ namespace App\Http\Controllers; -use App\Models\Configuration; use App\Models\CreditProduct; +use App\Models\Settings; use Illuminate\Support\Facades\Auth; class StoreController extends Controller @@ -15,17 +15,17 @@ class StoreController extends Controller if ( env('APP_ENV') == 'local' || - env('PAYPAL_SECRET') && env('PAYPAL_CLIENT_ID') || - env('STRIPE_SECRET') && env('STRIPE_ENDPOINT_SECRET') && env('STRIPE_METHODS') + Settings::getValueByKey("SETTINGS::PAYMENTS:PAYPAL:SECRET") && Settings::getValueByKey("SETTINGS::PAYMENTS:PAYPAL:CLIENT_ID") || + Settings::getValueByKey("SETTINGS::PAYMENTS:STRIPE:SECRET") && Settings::getValueByKey("SETTINGS::PAYMENTS:STRIPE:ENDPOINT_SECRET") && Settings::getValueByKey("SETTINGS::PAYMENTS:STRIPE:METHODS") ) $isPaymentSetup = true; //Required Verification for creating an server - if (Configuration::getValueByKey('FORCE_EMAIL_VERIFICATION', false) === 'true' && !Auth::user()->hasVerifiedEmail()) { + if (Settings::getValueByKey('SETTINGS::USER:FORCE_EMAIL_VERIFICATION', false) === 'true' && !Auth::user()->hasVerifiedEmail()) { return redirect()->route('profile.index')->with('error', __("You are required to verify your email address before you can purchase credits.")); } //Required Verification for creating an server - if (Configuration::getValueByKey('FORCE_DISCORD_VERIFICATION', false) === 'true' && !Auth::user()->discordUser) { + if (Settings::getValueByKey('SETTINGS::USER:FORCE_DISCORD_VERIFICATION', false) === 'true' && !Auth::user()->discordUser) { return redirect()->route('profile.index')->with('error', __("You are required to link your discord account before you can purchase Credits")); } diff --git a/app/Http/Controllers/TranslationController.php b/app/Http/Controllers/TranslationController.php index 40a6bd05..d771f8f2 100644 --- a/app/Http/Controllers/TranslationController.php +++ b/app/Http/Controllers/TranslationController.php @@ -18,4 +18,6 @@ class TranslationController extends Controller Session::put('locale', $request->inputLocale); return redirect()->back(); } + + } diff --git a/app/Http/Middleware/GlobalNames.php b/app/Http/Middleware/GlobalNames.php index 519b111d..fbff5594 100644 --- a/app/Http/Middleware/GlobalNames.php +++ b/app/Http/Middleware/GlobalNames.php @@ -3,6 +3,7 @@ namespace App\Http\Middleware; use App\Models\Configuration; +use App\Models\Settings; use Closure; use Illuminate\Http\Request; @@ -17,10 +18,10 @@ class GlobalNames */ public function handle(Request $request, Closure $next) { - define('CREDITS_DISPLAY_NAME' , Configuration::getValueByKey('CREDITS_DISPLAY_NAME' , 'Credits')); + define('CREDITS_DISPLAY_NAME', config('SETTINGS::SYSTEM:CREDITS_DISPLAY_NAME', 'Credits')); $unsupported_lang_array = explode(',', config("app.unsupported_locales")); - $unsupported_lang_array = array_map( 'strtolower', $unsupported_lang_array ); + $unsupported_lang_array = array_map('strtolower', $unsupported_lang_array); define('UNSUPPORTED_LANGS', $unsupported_lang_array); return $next($request); diff --git a/app/Http/Middleware/SetLocale.php b/app/Http/Middleware/SetLocale.php index c87e891d..bd5188b0 100644 --- a/app/Http/Middleware/SetLocale.php +++ b/app/Http/Middleware/SetLocale.php @@ -2,6 +2,7 @@ namespace App\Http\Middleware; +use App\Models\Settings; use Closure; use Illuminate\Http\Request; use Illuminate\Support\Facades\App; @@ -9,194 +10,6 @@ use Illuminate\Support\Facades\Session; class SetLocale { - function getLocaleCodeForDisplayLanguage($name){ - $languageCodes = array( - "aa" => "Afar", - "ab" => "Abkhazian", - "ae" => "Avestan", - "af" => "Afrikaans", - "ak" => "Akan", - "am" => "Amharic", - "an" => "Aragonese", - "ar" => "Arabic", - "as" => "Assamese", - "av" => "Avaric", - "ay" => "Aymara", - "az" => "Azerbaijani", - "ba" => "Bashkir", - "be" => "Belarusian", - "bg" => "Bulgarian", - "bh" => "Bihari", - "bi" => "Bislama", - "bm" => "Bambara", - "bn" => "Bengali", - "bo" => "Tibetan", - "br" => "Breton", - "bs" => "Bosnian", - "ca" => "Catalan", - "ce" => "Chechen", - "ch" => "Chamorro", - "co" => "Corsican", - "cr" => "Cree", - "cs" => "Czech", - "cu" => "Church Slavic", - "cv" => "Chuvash", - "cy" => "Welsh", - "da" => "Danish", - "de" => "German", - "dv" => "Divehi", - "dz" => "Dzongkha", - "ee" => "Ewe", - "el" => "Greek", - "en" => "English", - "eo" => "Esperanto", - "es" => "Spanish", - "et" => "Estonian", - "eu" => "Basque", - "fa" => "Persian", - "ff" => "Fulah", - "fi" => "Finnish", - "fj" => "Fijian", - "fo" => "Faroese", - "fr" => "French", - "fy" => "Western Frisian", - "ga" => "Irish", - "gd" => "Scottish Gaelic", - "gl" => "Galician", - "gn" => "Guarani", - "gu" => "Gujarati", - "gv" => "Manx", - "ha" => "Hausa", - "he" => "Hebrew", - "hi" => "Hindi", - "ho" => "Hiri Motu", - "hr" => "Croatian", - "ht" => "Haitian", - "hu" => "Hungarian", - "hy" => "Armenian", - "hz" => "Herero", - "ia" => "Interlingua (International Auxiliary Language Association)", - "id" => "Indonesian", - "ie" => "Interlingue", - "ig" => "Igbo", - "ii" => "Sichuan Yi", - "ik" => "Inupiaq", - "io" => "Ido", - "is" => "Icelandic", - "it" => "Italian", - "iu" => "Inuktitut", - "ja" => "Japanese", - "jv" => "Javanese", - "ka" => "Georgian", - "kg" => "Kongo", - "ki" => "Kikuyu", - "kj" => "Kwanyama", - "kk" => "Kazakh", - "kl" => "Kalaallisut", - "km" => "Khmer", - "kn" => "Kannada", - "ko" => "Korean", - "kr" => "Kanuri", - "ks" => "Kashmiri", - "ku" => "Kurdish", - "kv" => "Komi", - "kw" => "Cornish", - "ky" => "Kirghiz", - "la" => "Latin", - "lb" => "Luxembourgish", - "lg" => "Ganda", - "li" => "Limburgish", - "ln" => "Lingala", - "lo" => "Lao", - "lt" => "Lithuanian", - "lu" => "Luba-Katanga", - "lv" => "Latvian", - "mg" => "Malagasy", - "mh" => "Marshallese", - "mi" => "Maori", - "mk" => "Macedonian", - "ml" => "Malayalam", - "mn" => "Mongolian", - "mr" => "Marathi", - "ms" => "Malay", - "mt" => "Maltese", - "my" => "Burmese", - "na" => "Nauru", - "nb" => "Norwegian Bokmal", - "nd" => "North Ndebele", - "ne" => "Nepali", - "ng" => "Ndonga", - "nl" => "Dutch", - "nn" => "Norwegian Nynorsk", - "no" => "Norwegian", - "nr" => "South Ndebele", - "nv" => "Navajo", - "ny" => "Chichewa", - "oc" => "Occitan", - "oj" => "Ojibwa", - "om" => "Oromo", - "or" => "Oriya", - "os" => "Ossetian", - "pa" => "Panjabi", - "pi" => "Pali", - "pl" => "Polish", - "ps" => "Pashto", - "pt" => "Portuguese", - "qu" => "Quechua", - "rm" => "Raeto-Romance", - "rn" => "Kirundi", - "ro" => "Romanian", - "ru" => "Russian", - "rw" => "Kinyarwanda", - "sa" => "Sanskrit", - "sc" => "Sardinian", - "sd" => "Sindhi", - "se" => "Northern Sami", - "sg" => "Sango", - "si" => "Sinhala", - "sk" => "Slovak", - "sl" => "Slovenian", - "sm" => "Samoan", - "so" => "Somali", - "sq" => "Albanian", - "sr" => "Serbian", - "ss" => "Swati", - "st" => "Southern Sotho", - "su" => "Sundanese", - "sv" => "Swedish", - "sw" => "Swahili", - "ta" => "Tamil", - "te" => "Telugu", - "tg" => "Tajik", - "th" => "Thai", - "ti" => "Tigrinya", - "tk" => "Turkmen", - "tl" => "Tagalog", - "tn" => "Tswana", - "to" => "Tonga", - "tr" => "Turkish", - "ts" => "Tsonga", - "tt" => "Tatar", - "tw" => "Twi", - "ty" => "Tahitian", - "ug" => "Uighur", - "uk" => "Ukrainian", - "ur" => "Urdu", - "uz" => "Uzbek", - "ve" => "Venda", - "vi" => "Vietnamese", - "vo" => "Volapuk", - "wa" => "Walloon", - "wo" => "Wolof", - "xh" => "Xhosa", - "yi" => "Yiddish", - "yo" => "Yoruba", - "za" => "Zhuang", - "zh" => "Chinese", - "zu" => "Zulu" - ); - return array_search($name, array_flip($languageCodes)); - } /** * @@ -208,22 +21,19 @@ class SetLocale */ public function handle($request, Closure $next) { - - if (Session::has('locale')) { - $locale = Session::get('locale', config('app.locale')); + if (Session::has('locale')) { + $locale = Session::get('locale', config("SETTINGS::LOCALE:DEFAULT")); + } else { + if (config("SETTINGS::LOCALE:DYNAMIC") !== "true") { + $locale = config("SETTINGS::LOCALE:DEFAULT"); } else { - if (!config('app.dynamic_locale')) { - $locale = config('app.locale'); - }else{ - $locale = substr($request->server('HTTP_ACCEPT_LANGUAGE'), 0, 2); - - if (!in_array($locale, config('app.available_locales')) - || in_array(strtolower($this->getLocaleCodeForDisplayLanguage($locale)), UNSUPPORTED_LANGS)) { - $locale = config('app.locale'); - } + $locale = substr($request->server('HTTP_ACCEPT_LANGUAGE'), 0, 2); + if (!in_array($locale, explode(',', config("SETTINGS::LOCALE:AVAILABLE")))) { + $locale = config("SETTINGS::LOCALE:DEFAULT"); } } + } App::setLocale($locale); return $next($request); diff --git a/app/Listeners/UnsuspendServers.php b/app/Listeners/UnsuspendServers.php index 51f1ad60..5d8ce069 100644 --- a/app/Listeners/UnsuspendServers.php +++ b/app/Listeners/UnsuspendServers.php @@ -3,11 +3,10 @@ namespace App\Listeners; use App\Events\UserUpdateCreditsEvent; -use App\Models\Configuration; use App\Models\Server; +use App\Models\Settings; use Exception; use Illuminate\Contracts\Queue\ShouldQueue; -use Illuminate\Queue\InteractsWithQueue; class UnsuspendServers implements ShouldQueue { @@ -20,7 +19,7 @@ class UnsuspendServers implements ShouldQueue */ public function handle(UserUpdateCreditsEvent $event) { - if ($event->user->credits > Configuration::getValueByKey('MINIMUM_REQUIRED_CREDITS_TO_MAKE_SERVER' , 50)){ + if ($event->user->credits > Settings::getValueByKey('SETTINGS::USER:MINIMUM_REQUIRED_CREDITS_TO_MAKE_SERVER' , 50)){ /** @var Server $server */ foreach ($event->user->servers as $server){ if ($server->isSuspended()) $server->unSuspend(); diff --git a/app/Listeners/Verified.php b/app/Listeners/Verified.php index b87ff058..875bd4c0 100644 --- a/app/Listeners/Verified.php +++ b/app/Listeners/Verified.php @@ -2,9 +2,7 @@ namespace App\Listeners; -use App\Models\Configuration; -use Illuminate\Contracts\Queue\ShouldQueue; -use Illuminate\Queue\InteractsWithQueue; +use App\Models\Settings; class Verified { @@ -26,7 +24,7 @@ class Verified */ public function handle($event) { - $event->user->increment('server_limit' , Configuration::getValueByKey('SERVER_LIMIT_REWARD_AFTER_VERIFY_EMAIL')); - $event->user->increment('credits' , Configuration::getValueByKey('CREDITS_REWARD_AFTER_VERIFY_EMAIL')); + $event->user->increment('server_limit' , Settings::getValueByKey('SETTINGS::USER:SERVER_LIMIT_REWARD_AFTER_VERIFY_EMAIL')); + $event->user->increment('credits' , Settings::getValueByKey('SETTINGS::USER:CREDITS_REWARD_AFTER_VERIFY_EMAIL')); } } diff --git a/app/Models/CreditProduct.php b/app/Models/CreditProduct.php index 1effeb6f..5fa07b59 100644 --- a/app/Models/CreditProduct.php +++ b/app/Models/CreditProduct.php @@ -59,7 +59,7 @@ class CreditProduct extends Model */ public function getTaxPercent() { - $tax = Configuration::getValueByKey("SALES_TAX"); + $tax = Settings::getValueByKey("SETTINGS::PAYMENTS:SALES_TAX"); return $tax < 0 ? 0 : $tax; } diff --git a/app/Models/InvoiceSettings.php b/app/Models/InvoiceSettings.php deleted file mode 100644 index c246f165..00000000 --- a/app/Models/InvoiceSettings.php +++ /dev/null @@ -1,23 +0,0 @@ -key); + static::updated(function (Settings $settings) { + Cache::forget(self::CACHE_TAG .':'. $settings->key); }); } @@ -41,8 +43,8 @@ class Configuration extends Model public static function getValueByKey(string $key, $default = null) { return Cache::rememberForever(self::CACHE_TAG .':'. $key, function () use ($default, $key) { - $configuration = self::find($key); - return $configuration ? $configuration->value : $default; + $settings = self::find($key); + return $settings ? $settings->value : $default; }); } } diff --git a/app/Notifications/ServersSuspendedNotification.php b/app/Notifications/ServersSuspendedNotification.php index c73f8c0d..c6ed279b 100644 --- a/app/Notifications/ServersSuspendedNotification.php +++ b/app/Notifications/ServersSuspendedNotification.php @@ -2,7 +2,6 @@ namespace App\Notifications; -use App\Models\Configuration; use Illuminate\Bus\Queueable; use Illuminate\Contracts\Queue\ShouldQueue; use Illuminate\Notifications\Messages\MailMessage; diff --git a/app/Notifications/WelcomeMessage.php b/app/Notifications/WelcomeMessage.php index 3c730486..a7854478 100644 --- a/app/Notifications/WelcomeMessage.php +++ b/app/Notifications/WelcomeMessage.php @@ -2,7 +2,7 @@ namespace App\Notifications; -use App\Models\Configuration; +use App\Models\Settings; use App\Models\User; use Illuminate\Bus\Queueable; use Illuminate\Contracts\Queue\ShouldQueue; @@ -38,25 +38,25 @@ class WelcomeMessage extends Notification implements ShouldQueue return ['database']; } public function AdditionalLines() - { + { - $AdditionalLine = ""; - if(Configuration::getValueByKey('CREDITS_REWARD_AFTER_VERIFY_EMAIL') != 0) { - $AdditionalLine .= "Verifying your e-mail address will grant you ".Configuration::getValueByKey('CREDITS_REWARD_AFTER_VERIFY_EMAIL')." additional " . Configuration::getValueByKey('CREDITS_DISPLAY_NAME') . ".
"; - } - if(Configuration::getValueByKey('SERVER_LIMIT_REWARD_AFTER_VERIFY_EMAIL') != 0) { - $AdditionalLine .= "Verifying your e-mail will also increase your Server Limit by " . Configuration::getValueByKey('SERVER_LIMIT_REWARD_AFTER_VERIFY_EMAIL') . ".
"; - } - $AdditionalLine .="
"; - if(Configuration::getValueByKey('CREDITS_REWARD_AFTER_VERIFY_DISCORD') != 0) { - $AdditionalLine .= "You can also verify your discord account to get another " . Configuration::getValueByKey('CREDITS_REWARD_AFTER_VERIFY_DISCORD') . " " . Configuration::getValueByKey('CREDITS_DISPLAY_NAME') . ".
"; - } - if(Configuration::getValueByKey('SERVER_LIMIT_REWARD_AFTER_VERIFY_DISCORD') != 0) { - $AdditionalLine .= "Verifying your Discord account will also increase your Server Limit by " . Configuration::getValueByKey('SERVER_LIMIT_REWARD_AFTER_VERIFY_DISCORD') . ".
"; - } - - return $AdditionalLine; + $AdditionalLine = ""; + if (config('SETTINGS::USER:CREDITS_REWARD_AFTER_VERIFY_EMAIL') != 0) { + $AdditionalLine .= "Verifying your e-mail address will grant you " . config('SETTINGS::USER:CREDITS_REWARD_AFTER_VERIFY_EMAIL') . " additional " . config('SETTINGS::SYSTEM:CREDITS_DISPLAY_NAME') . ".
"; } + if (config('SETTINGS::USER:SERVER_LIMIT_REWARD_AFTER_VERIFY_EMAIL') != 0) { + $AdditionalLine .= "Verifying your e-mail will also increase your Server Limit by " . config('SETTINGS::USER:SERVER_LIMIT_REWARD_AFTER_VERIFY_EMAIL') . ".
"; + } + $AdditionalLine .= "
"; + if (config('SETTINGS::USER:CREDITS_REWARD_AFTER_VERIFY_DISCORD') != 0) { + $AdditionalLine .= "You can also verify your discord account to get another " . config('SETTINGS::USER:CREDITS_REWARD_AFTER_VERIFY_DISCORD') . " " . config('SETTINGS::SYSTEM:CREDITS_DISPLAY_NAME') . ".
"; + } + if (config('SETTINGS::USER:SERVER_LIMIT_REWARD_AFTER_VERIFY_DISCORD') != 0) { + $AdditionalLine .= "Verifying your Discord account will also increase your Server Limit by " . config('SETTINGS::USER:SERVER_LIMIT_REWARD_AFTER_VERIFY_DISCORD') . ".
"; + } + + return $AdditionalLine; + } /** * Get the array representation of the notification. * @@ -72,7 +72,7 @@ class WelcomeMessage extends Notification implements ShouldQueue
Verification

You can verify your e-mail address and link/verify your Discord account.

- ".$this->AdditionalLines()." + " . $this->AdditionalLines() . "

Information

This dashboard can be used to create and delete servers.
These servers can be used and managed on our pterodactyl panel.
If you have any questions, please join our Discord server and #create-a-ticket.

diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index 189f64bf..33df8145 100644 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -2,11 +2,13 @@ namespace App\Providers; +use App\Models\Settings; use Illuminate\Pagination\Paginator; +use Illuminate\Support\Facades\Artisan; use Illuminate\Support\Facades\Schema; use Illuminate\Support\Facades\Validator; use Illuminate\Support\ServiceProvider; -use Spatie\QueryBuilder\QueryBuilderRequest; + class AppServiceProvider extends ServiceProvider { @@ -31,14 +33,11 @@ class AppServiceProvider extends ServiceProvider Schema::defaultStringLength(191); Validator::extend('multiple_date_format', function ($attribute, $value, $parameters, $validator) { - $ok = true; - $result = []; // iterate through all formats foreach ($parameters as $parameter) { - //validate with laravels standard date format validation $result[] = $validator->validateDateFormat($attribute, $value, [$parameter]); } @@ -51,5 +50,59 @@ class AppServiceProvider extends ServiceProvider return $ok; }); + + + // TODO: Check if Installer Lockfile exists instead of "running in console" + $settings = Settings::all(); + // Set all configs from database + foreach ($settings as $setting) { + config([$setting->key => $setting->value]); + } + + // Set Mail Config + //only update config if mail settings have changed in DB + if ( + config('mail.default') != config('SETTINGS:MAIL:MAILER') || + config('mail.mailers.smtp.host') != config('SETTINGS:MAIL:HOST') || + config('mail.mailers.smtp.port') != config('SETTINGS:MAIL:PORT') || + config('mail.mailers.smtp.username') != config('SETTINGS:MAIL:USERNAME') || + config('mail.mailers.smtp.password') != config('SETTINGS:MAIL:PASSWORD') || + config('mail.mailers.smtp.encryption') != config('SETTINGS:MAIL:ENCRYPTION') || + config('mail.from.address') != config('SETTINGS:MAIL:FROM_ADDRESS') || + config('mail.from.name') != config('SETTINGS:MAIL:FROM_NAME') + ) { + config(['mail.default' => config('SETTINGS::MAIL:MAILER')]); + config(['mail.mailers.smtp' => [ + 'transport' => 'smtp', + 'host' => config('SETTINGS::MAIL:HOST'), + 'port' => config('SETTINGS::MAIL:PORT'), + 'encryption' => config('SETTINGS::MAIL:ENCRYPTION'), + 'username' => config('SETTINGS::MAIL:USERNAME'), + 'password' => config('SETTINGS::MAIL:PASSWORD'), + 'timeout' => null, + 'auth_mode' => null, + ]]); + config(['mail.from' => ['address' => config('SETTINGS::MAIL:FROM_ADDRESS'), 'name' => config('SETTINGS::MAIL:FROM_NAME')]]); + + Artisan::call('queue:restart'); + } + + + // Set Recaptcha API Config + //only update config if recaptcha settings have changed in DB + if ( + config('recaptcha.api_site_key') != config('SETTINGS::RECAPTCHA:SITE_KEY') || + config('recaptcha.api_secret_key') != config('SETTINGS::RECAPTCHA:SECRET_KEY') + ) { + config(['recaptcha.api_site_key' => config('SETTINGS::RECAPTCHA:SITE_KEY')]); + config(['recaptcha.api_secret_key' => config('SETTINGS::RECAPTCHA:SECRET_KEY')]); + + Artisan::call('config:clear'); + Artisan::call('cache:clear'); + } + + // Set Discord-API Config + config(['services.discord.client_id' => config('SETTINGS::DISCORD:CLIENT_ID')]); + config(['services.discord.client_secret' => config('SETTINGS::DISCORD:CLIENT_SECRET')]); } } diff --git a/config/app.php b/config/app.php index 5ed68b37..c490961f 100644 --- a/config/app.php +++ b/config/app.php @@ -1,5 +1,7 @@ '0.6.2', @@ -70,16 +72,6 @@ return [ 'timezone' => env('APP_TIMEZONE', 'UTC'), - /* - |-------------------------------------------------------------------------- - | Dyamic Locales - |-------------------------------------------------------------------------- - | - | Change the Locale depending on the Users Browserlanguage - | Can either be true or false - | - */ - 'dynamic_locale' => env('DYNAMIC_LOCALE', false), /* |-------------------------------------------------------------------------- @@ -92,47 +84,20 @@ return [ | */ - 'locale' => env('LOCALE', 'en'), - + 'locale' =>"en", /* |-------------------------------------------------------------------------- - | Available Locales + | Available Languages |-------------------------------------------------------------------------- | - | You should not change this - | If the dashboard is 100% translated in a certain language, it will be added here - | - */ - 'available_locales' => array('English'=>'en','German'=>'de','Italian'=>'it','Chinese'=>'zh', 'Czech'=>'cs', 'Spanish'=>'es', 'Polish'=>'pl'), - - - /* - |-------------------------------------------------------------------------- - | Unsupported Locales - |-------------------------------------------------------------------------- - | - | Locales the Owner of the Dashboard does not want to support - | + | The application locale determines the default locale that will be used + | by the translation service provider. You are free to set this value + | to any of the locales which will be supported by the application. | */ - 'unsupported_locales' => env("UNSUPPORTED_LOCALES", ""), - - - /* - |-------------------------------------------------------------------------- - | Datatable Language Setting - |-------------------------------------------------------------------------- - | - | This is the Language-Code used on the Datatables. - | You can grab the Language-Codes from this Website - | https://datatables.net/plug-ins/i18n/ - | - */ - - 'datatable_locale' => env('DATATABLE_LOCALE', 'en-gb'), - + 'available_locales' =>["en","cs","de","es","fr","hi","it","pl","zh"], /* |-------------------------------------------------------------------------- diff --git a/config/mail.php b/config/mail.php index 54299aab..3addd6aa 100644 --- a/config/mail.php +++ b/config/mail.php @@ -45,31 +45,22 @@ return [ 'auth_mode' => null, ], - 'ses' => [ - 'transport' => 'ses', - ], - - 'mailgun' => [ - 'transport' => 'mailgun', - ], - - 'postmark' => [ - 'transport' => 'postmark', - ], - - 'sendmail' => [ - 'transport' => 'sendmail', - 'path' => '/usr/sbin/sendmail -bs', - ], - - 'log' => [ - 'transport' => 'log', - 'channel' => env('MAIL_LOG_CHANNEL'), - ], - - 'array' => [ - 'transport' => 'array', - ], + // 'ses' => [ + // 'transport' => 'ses', + // ], + // + // 'mailgun' => [ + // 'transport' => 'mailgun', + // ], + // + // 'postmark' => [ + // 'transport' => 'postmark', + // ], + // + // 'sendmail' => [ + // 'transport' => 'sendmail', + // 'path' => '/usr/sbin/sendmail -bs', + // ], ], /* diff --git a/database/migrations/2021_05_08_164658_create_configurations_table.php b/database/migrations/2021_05_08_164658_create_configurations_table.php deleted file mode 100644 index f353c4aa..00000000 --- a/database/migrations/2021_05_08_164658_create_configurations_table.php +++ /dev/null @@ -1,34 +0,0 @@ -string('key')->primary(); - $table->string('value'); - $table->string('type')->default('string'); - $table->text('description')->nullable(); - $table->timestamps(); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::dropIfExists('configurations'); - } -} diff --git a/database/migrations/2021_12_1_174440_invoice-settings.php b/database/migrations/2021_12_1_174440_invoice-settings.php deleted file mode 100644 index 8615d59b..00000000 --- a/database/migrations/2021_12_1_174440_invoice-settings.php +++ /dev/null @@ -1,48 +0,0 @@ -id(); - $table->string('company_name')->nullable(); - $table->string('company_adress')->nullable(); - $table->string('company_phone')->nullable(); - $table->string('company_vat')->nullable(); - $table->string('company_mail')->nullable(); - $table->string('company_web')->nullable()->default(env("APP_URL","")); - $table->string('invoice_prefix')->nullable(); - $table->timestamps(); - }); - - DB::table('invoice_settings')->insert( - array( - 'company_name' => env("APP_NAME","MyCompany"), - 'company_web' => env("APP_URL",""), - 'invoice_prefix' => "INV" - - ) - ); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::dropIfExists('invoice_settings'); - } -} diff --git a/database/migrations/2022_01_05_144858_rename_configurations_table.php b/database/migrations/2022_01_05_144858_rename_configurations_table.php new file mode 100644 index 00000000..81b4c5a9 --- /dev/null +++ b/database/migrations/2022_01_05_144858_rename_configurations_table.php @@ -0,0 +1,61 @@ +where('key', 'INITIAL_CREDITS')->update(['key' => 'SETTINGS::USER:INITIAL_CREDITS']); + DB::table('settings')->where('key', 'INITIAL_SERVER_LIMIT')->update(['key' => 'SETTINGS::USER:INITIAL_SERVER_LIMIT']); + DB::table('settings')->where('key', 'CREDITS_REWARD_AFTER_VERIFY_EMAIL')->update(['key' => 'SETTINGS::USER:CREDITS_REWARD_AFTER_VERIFY_EMAIL']); + DB::table('settings')->where('key', 'SERVER_LIMIT_REWARD_AFTER_VERIFY_EMAIL')->update(['key' => 'SETTINGS::USER:SERVER_LIMIT_REWARD_AFTER_VERIFY_EMAIL']); + DB::table('settings')->where('key', 'CREDITS_REWARD_AFTER_VERIFY_DISCORD')->update(['key' => 'SETTINGS::USER:CREDITS_REWARD_AFTER_VERIFY_DISCORD']); + DB::table('settings')->where('key', 'SERVER_LIMIT_REWARD_AFTER_VERIFY_DISCORD')->update(['key' => 'SETTINGS::USER:SERVER_LIMIT_REWARD_AFTER_VERIFY_DISCORD']); + DB::table('settings')->where('key', 'MINIMUM_REQUIRED_CREDITS_TO_MAKE_SERVER')->update(['key' => 'SETTINGS::USER:MINIMUM_REQUIRED_CREDITS_TO_MAKE_SERVER']); + DB::table('settings')->where('key', 'SERVER_LIMIT_AFTER_IRL_PURCHASE')->update(['key' => 'SETTINGS::USER:SERVER_LIMIT_AFTER_IRL_PURCHASE']); + DB::table('settings')->where('key', 'FORCE_EMAIL_VERIFICATION')->update(['key' => 'SETTINGS::USER:FORCE_EMAIL_VERIFICATION']); + DB::table('settings')->where('key', 'FORCE_DISCORD_VERIFICATION')->update(['key' => 'SETTINGS::USER:FORCE_DISCORD_VERIFICATION']); + DB::table('settings')->where('key', 'REGISTER_IP_CHECK')->update(['key' => 'SETTINGS::SYSTEM:REGISTER_IP_CHECK']); + DB::table('settings')->where('key', 'CREDITS_DISPLAY_NAME')->update(['key' => 'SETTINGS::SYSTEM:CREDITS_DISPLAY_NAME']); + DB::table('settings')->where('key', 'ALLOCATION_LIMIT')->update(['key' => 'SETTINGS::SERVER:ALLOCATION_LIMIT']); + DB::table('settings')->where('key', 'SERVER_CREATE_CHARGE_FIRST_HOUR')->update(['key' => 'SETTINGS::SYSTEM:SERVER_CREATE_CHARGE_FIRST_HOUR']); + DB::table('settings')->where('key', 'SALES_TAX')->update(['key' => 'SETTINGS::PAYMENTS:SALES_TAX']); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::rename('settings', 'configurations'); + + DB::table('configurations')->where('key', 'SETTINGS::USER:INITIAL_CREDITS')->update(['key' => 'INITIAL_CREDITS']); + DB::table('configurations')->where('key', 'SETTINGS::USER:INITIAL_SERVER_LIMIT')->update(['key' => 'INITIAL_SERVER_LIMIT']); + DB::table('configurations')->where('key', 'SETTINGS::USER:CREDITS_REWARD_AFTER_VERIFY_EMAIL')->update(['key' => 'CREDITS_REWARD_AFTER_VERIFY_EMAIL']); + DB::table('configurations')->where('key', 'SETTINGS::USER:SERVER_LIMIT_REWARD_AFTER_VERIFY_EMAIL')->update(['key' => 'SERVER_LIMIT_REWARD_AFTER_VERIFY_EMAIL']); + DB::table('configurations')->where('key', 'SETTINGS::USER:CREDITS_REWARD_AFTER_VERIFY_DISCORD')->update(['key' => 'CREDITS_REWARD_AFTER_VERIFY_DISCORD']); + DB::table('configurations')->where('key', 'SETTINGS::USER:SERVER_LIMIT_REWARD_AFTER_VERIFY_DISCORD')->update(['key' => 'SERVER_LIMIT_REWARD_AFTER_VERIFY_DISCORD']); + DB::table('configurations')->where('key', 'SETTINGS::USER:MINIMUM_REQUIRED_CREDITS_TO_MAKE_SERVER')->update(['key' => 'MINIMUM_REQUIRED_CREDITS_TO_MAKE_SERVER']); + DB::table('configurations')->where('key', 'SETTINGS::USER:SERVER_LIMIT_AFTER_IRL_PURCHASE')->update(['key' => 'SERVER_LIMIT_AFTER_IRL_PURCHASE']); + DB::table('configurations')->where('key', 'SETTINGS::USER:FORCE_EMAIL_VERIFICATION')->update(['key' => 'FORCE_EMAIL_VERIFICATION']); + DB::table('configurations')->where('key', 'SETTINGS::USER:FORCE_DISCORD_VERIFICATION')->update(['key' => 'FORCE_DISCORD_VERIFICATION']); + DB::table('configurations')->where('key', 'SETTINGS::SYSTEM:REGISTER_IP_CHECK')->update(['key' => 'REGISTER_IP_CHECK']); + DB::table('configurations')->where('key', 'SETTINGS::SYSTEM:SERVER_CREATE_CHARGE_FIRST_HOUR')->update(['key' => 'SERVER_CREATE_CHARGE_FIRST_HOUR']); + DB::table('configurations')->where('key', 'SETTINGS::SERVER:ALLOCATION_LIMIT')->update(['key' => 'ALLOCATION_LIMIT']); + DB::table('configurations')->where('key', 'SETTINGS::SERVER:CREDITS_DISPLAY_NAME')->update(['key' => 'SETTINGS::SYSTEM:CREDITS_DISPLAY_NAME']); + DB::table('configurations')->where('key', 'SETTINGS::PAYMENTS:SALES_TAX')->update(['key' => 'SALES_TAX']); + } +} diff --git a/database/migrations/2022_01_14_234418_update_settings_table_allow_nullable.php b/database/migrations/2022_01_14_234418_update_settings_table_allow_nullable.php new file mode 100644 index 00000000..20d5a0c9 --- /dev/null +++ b/database/migrations/2022_01_14_234418_update_settings_table_allow_nullable.php @@ -0,0 +1,34 @@ +string('value')->nullable()->change(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + //disallow value column in settings table to be nullable + Schema::table('settings', function (Blueprint $table) { + $table->string('value')->nullable(false)->change(); + }); + } +} diff --git a/database/seeders/DatabaseSeeder.php b/database/seeders/DatabaseSeeder.php index f275ede7..e759a595 100644 --- a/database/seeders/DatabaseSeeder.php +++ b/database/seeders/DatabaseSeeder.php @@ -2,8 +2,7 @@ namespace Database\Seeders; -use Database\Seeders\Seeds\ConfigurationSeeder; -use Database\Seeders\Seeds\InvoiceSettingsSeeder; +use Database\Seeders\Seeds\SettingsSeeder; use Illuminate\Database\Seeder; class DatabaseSeeder extends Seeder @@ -16,7 +15,7 @@ class DatabaseSeeder extends Seeder public function run() { $this->call([ - ConfigurationSeeder::class, + SettingsSeeder::class, ]); } diff --git a/database/seeders/Seeds/ConfigurationSeeder.php b/database/seeders/Seeds/ConfigurationSeeder.php deleted file mode 100644 index 98d3a57a..00000000 --- a/database/seeders/Seeds/ConfigurationSeeder.php +++ /dev/null @@ -1,149 +0,0 @@ - 'INITIAL_CREDITS', - ], [ - 'value' => '250', - 'type' => 'integer', - 'description' => 'The initial amount of credits the user starts with.' - ]); - - Configuration::firstOrCreate([ - 'key' => 'INITIAL_SERVER_LIMIT', - ], [ - 'value' => '1', - 'type' => 'integer', - 'description' => 'The initial server limit the user starts with.' - ]); - - //verify email event - Configuration::firstOrCreate([ - 'key' => 'CREDITS_REWARD_AFTER_VERIFY_EMAIL', - ], [ - 'value' => '250', - 'type' => 'integer', - 'description' => 'Increase in credits after the user has verified their email account.' - ]); - - Configuration::firstOrCreate([ - 'key' => 'SERVER_LIMIT_REWARD_AFTER_VERIFY_EMAIL', - ], [ - 'value' => '2', - 'type' => 'integer', - 'description' => 'Increase in server limit after the user has verified their email account.' - ]); - - //verify discord event - Configuration::firstOrCreate([ - 'key' => 'CREDITS_REWARD_AFTER_VERIFY_DISCORD', - ], [ - 'value' => '375', - 'type' => 'integer', - 'description' => 'Increase in credits after the user has verified their discord account.' - ]); - - Configuration::firstOrCreate([ - 'key' => 'SERVER_LIMIT_REWARD_AFTER_VERIFY_DISCORD', - ], [ - 'value' => '2', - 'type' => 'integer', - 'description' => 'Increase in server limit after the user has verified their discord account.' - ]); - - //other - Configuration::firstOrCreate([ - 'key' => 'MINIMUM_REQUIRED_CREDITS_TO_MAKE_SERVER', - ], [ - 'value' => '50', - 'type' => 'integer', - 'description' => 'The minimum amount of credits the user would need to make a server.' - ]); - - //purchasing - Configuration::firstOrCreate([ - 'key' => 'SERVER_LIMIT_AFTER_IRL_PURCHASE', - ], [ - 'value' => '10', - 'type' => 'integer', - 'description' => 'updates the users server limit to this amount (unless the user already has a higher server limit) after making a purchase with real money, set to 0 to ignore this.', - ]); - - - //force email and discord verification - Configuration::firstOrCreate([ - 'key' => 'FORCE_EMAIL_VERIFICATION', - ], [ - 'value' => 'false', - 'type' => 'boolean', - 'description' => 'Force an user to verify the email adress before creating a server / buying credits.' - ]); - - Configuration::firstOrCreate([ - 'key' => 'FORCE_DISCORD_VERIFICATION', - ], [ - 'value' => 'false', - 'type' => 'boolean', - 'description' => 'Force an user to link an Discord Account before creating a server / buying credits.' - ]); - - //disable ip check on register - Configuration::firstOrCreate([ - 'key' => 'REGISTER_IP_CHECK', - ], [ - 'value' => 'true', - 'type' => 'boolean', - 'description' => 'Prevent users from making multiple accounts using the same IP address' - ]); - - //per_page on allocations request - Configuration::firstOrCreate([ - 'key' => 'ALLOCATION_LIMIT', - ], [ - 'value' => '200', - 'type' => 'integer', - 'description' => 'The maximum amount of allocations to pull per node for automatic deployment, if more allocations are being used than this limit is set to, no new servers can be created!' - ]); - - //credits display name - Configuration::firstOrCreate([ - 'key' => 'CREDITS_DISPLAY_NAME', - ], [ - 'value' => 'Credits', - 'type' => 'string', - 'description' => 'Set the display name of your currency :)' - ]); - - //credits display name - Configuration::firstOrCreate([ - 'key' => 'SERVER_CREATE_CHARGE_FIRST_HOUR', - ], [ - 'value' => 'true', - 'type' => 'boolean', - 'description' => 'Charges the first hour worth of credits upon creating a server.' - ]); - //sales tax - Configuration::firstOrCreate([ - 'key' => 'SALES_TAX', - ], [ - 'value' => '0', - 'type' => 'integer', - 'description' => 'The %-value of tax that will be added to the product price on checkout' - ]); - - } -} diff --git a/database/seeders/Seeds/SettingsSeeder.php b/database/seeders/Seeds/SettingsSeeder.php new file mode 100644 index 00000000..19389f1d --- /dev/null +++ b/database/seeders/Seeds/SettingsSeeder.php @@ -0,0 +1,468 @@ + 'SETTINGS::USER:INITIAL_CREDITS', + ], [ + 'value' => '250', + 'type' => 'integer', + 'description' => 'The initial amount of credits the user starts with.' + ]); + + Settings::firstOrCreate([ + 'key' => 'SETTINGS::USER:NITIAL_SERVER_LIMIT', + ], [ + 'value' => '1', + 'type' => 'integer', + 'description' => 'The initial server limit the user starts with.' + ]); + + //verify email event + Settings::firstOrCreate([ + 'key' => 'SETTINGS::USER:CREDITS_REWARD_AFTER_VERIFY_EMAIL', + ], [ + 'value' => '250', + 'type' => 'integer', + 'description' => 'Increase in credits after the user has verified their email account.' + ]); + + Settings::firstOrCreate([ + 'key' => 'SETTINGS::USER:SERVER_LIMIT_REWARD_AFTER_VERIFY_EMAIL', + ], [ + 'value' => '2', + 'type' => 'integer', + 'description' => 'Increase in server limit after the user has verified their email account.' + ]); + + //verify discord event + Settings::firstOrCreate([ + 'key' => 'SETTINGS::USER:CREDITS_REWARD_AFTER_VERIFY_DISCORD', + ], [ + 'value' => '375', + 'type' => 'integer', + 'description' => 'Increase in credits after the user has verified their discord account.' + ]); + + Settings::firstOrCreate([ + 'key' => 'SETTINGS::USER:SERVER_LIMIT_REWARD_AFTER_VERIFY_DISCORD', + ], [ + 'value' => '2', + 'type' => 'integer', + 'description' => 'Increase in server limit after the user has verified their discord account.' + ]); + + //other + Settings::firstOrCreate([ + 'key' => 'SETTINGS::USER:MINIMUM_REQUIRED_CREDITS_TO_MAKE_SERVER', + ], [ + 'value' => '50', + 'type' => 'integer', + 'description' => 'The minimum amount of credits the user would need to make a server.' + ]); + + //purchasing + Settings::firstOrCreate([ + 'key' => 'SETTINGS::USER:SERVER_LIMIT_AFTER_IRL_PURCHASE', + ], [ + 'value' => '10', + 'type' => 'integer', + 'description' => 'updates the users server limit to this amount (unless the user already has a higher server limit) after making a purchase with real money, set to 0 to ignore this.', + ]); + + + //force email and discord verification + Settings::firstOrCreate([ + 'key' => 'SETTINGS::USER:FORCE_EMAIL_VERIFICATION', + ], [ + 'value' => 'false', + 'type' => 'boolean', + 'description' => 'Force an user to verify the email adress before creating a server / buying credits.' + ]); + + Settings::firstOrCreate([ + 'key' => 'SETTINGS::USER:FORCE_DISCORD_VERIFICATION', + ], [ + 'value' => 'false', + 'type' => 'boolean', + 'description' => 'Force an user to link an Discord Account before creating a server / buying credits.' + ]); + + //disable ip check on register + Settings::firstOrCreate([ + 'key' => 'SETTINGS::SYSTEM:REGISTER_IP_CHECK', + ], [ + 'value' => 'true', + 'type' => 'boolean', + 'description' => 'Prevent users from making multiple accounts using the same IP address' + ]); + + //per_page on allocations request + Settings::firstOrCreate([ + 'key' => 'SETTINGS::SERVER:ALLOCATION_LIMIT', + ], [ + 'value' => '200', + 'type' => 'integer', + 'description' => 'The maximum amount of allocations to pull per node for automatic deployment, if more allocations are being used than this limit is set to, no new servers can be created!' + ]); + + //credits display name + Settings::firstOrCreate([ + 'key' => 'SETTINGS::SYSTEM:CREDITS_DISPLAY_NAME', + ], [ + 'value' => 'Credits', + 'type' => 'string', + 'description' => 'Set the display name of your currency :)' + ]); + + //credits display name + Settings::firstOrCreate([ + 'key' => 'SETTINGS::SYSTEM:SERVER_CREATE_CHARGE_FIRST_HOUR', + ], [ + 'value' => 'true', + 'type' => 'boolean', + 'description' => 'Charges the first hour worth of credits upon creating a server.' + ]); + //sales tax + Settings::firstOrCreate([ + 'key' => 'SETTINGS::PAYMENTS:SALES_TAX', + ], [ + 'value' => '0', + 'type' => 'integer', + 'description' => 'The %-value of tax that will be added to the product price on checkout' + ]); + //Invoices enabled + Settings::firstOrCreate([ + 'key' => 'SETTINGS::INVOICE:ENABLED', + ], [ + 'value' => 'false', + 'type' => 'boolean', + ]); + //Invoice company name + Settings::firstOrCreate([ + 'key' => 'SETTINGS::INVOICE:COMPANY_NAME', + ], [ + 'value' => '', + 'type' => 'string', + 'description' => 'The name of the Company on the Invoices' + ]); + //Invoice company address + Settings::firstOrCreate([ + 'key' => 'SETTINGS::INVOICE:COMPANY_ADDRESS', + ], [ + 'value' => '', + 'type' => 'string', + 'description' => 'The address of the Company on the Invoices' + ]); + //Invoice company phone + Settings::firstOrCreate([ + 'key' => 'SETTINGS::INVOICE:COMPANY_PHONE', + ], [ + 'value' => '', + 'type' => 'string', + 'description' => 'The phone number of the Company on the Invoices' + ]); + + //Invoice company mail + Settings::firstOrCreate([ + 'key' => 'SETTINGS::INVOICE:COMPANY_MAIL', + ], [ + 'value' => '', + 'type' => 'string', + 'description' => 'The email address of the Company on the Invoices' + ]); + + //Invoice VAT + Settings::firstOrCreate([ + 'key' => 'SETTINGS::INVOICE:COMPANY_VAT', + ], [ + 'value' => '', + 'type' => 'string', + 'description' => 'The VAT-Number of the Company on the Invoices' + ]); + + //Invoice Website + Settings::firstOrCreate([ + 'key' => 'SETTINGS::INVOICE:COMPANY_WEBSITE', + ], [ + 'value' => '', + 'type' => 'string', + 'description' => 'The Website of the Company on the Invoices' + ]); + + //Invoice Website + Settings::firstOrCreate([ + 'key' => 'SETTINGS::INVOICE:PREFIX', + ], [ + 'value' => 'INV', + 'type' => 'string', + 'description' => 'The invoice prefix' + ]); + + //Locale + Settings::firstOrCreate([ + 'key' => 'SETTINGS::LOCALE:DEFAULT', + ], [ + 'value' => 'en', + 'type' => 'string', + 'description' => 'The default Language the dashboard will be shown in' + ]); + //Dynamic locale + Settings::firstOrCreate([ + 'key' => 'SETTINGS::LOCALE:DYNAMIC', + ], [ + 'value' => 'false', + 'type' => 'boolean', + 'description' => 'If this is true, the Language will change to the Clients browserlanguage or default.' + ]); + //User can change Locale + Settings::firstOrCreate([ + 'key' => 'SETTINGS::LOCALE:CLIENTS_CAN_CHANGE', + ], [ + 'value' => 'false', + 'type' => 'boolean', + 'description' => 'If this is true, the clients will be able to change their Locale.' + ]); + //Locale + Settings::firstOrCreate([ + 'key' => 'SETTINGS::LOCALE:AVAILABLE', + ], [ + 'value' => '', + 'type' => 'string', + 'description' => 'The available languages' + ]); + //Locale + Settings::firstOrCreate([ + 'key' => 'SETTINGS::LOCALE:DATATABLES', + ], [ + 'value' => 'en-gb', + 'type' => 'string', + 'description' => 'The Language of the Datatables. Grab the Language-Codes from here https://datatables.net/plug-ins/i18n/' + ]); + + Settings::firstOrCreate([ + 'key' => 'SETTINGS::PAYMENTS:PAYPAL:SECRET', + ], [ + 'value' => '', + 'type' => 'string', + 'description' => 'Your PayPal Secret-Key ( https://developer.paypal.com/docs/integration/direct/rest/)' + ]); + Settings::firstOrCreate([ + 'key' => 'SETTINGS::PAYMENTS:PAYPAL:CLIENT_ID', + ], [ + 'value' => '', + 'type' => 'string', + 'description' => 'Your PayPal Client_ID' + ]); + Settings::firstOrCreate([ + 'key' => 'SETTINGS::PAYMENTS:PAYPAL:SANDBOX_SECRET', + ], [ + 'value' => '', + 'type' => 'string', + 'description' => 'Your PayPal SANDBOX Secret-Key used for testing ' + ]); + Settings::firstOrCreate([ + 'key' => 'SETTINGS::PAYMENTS:PAYPAL:SANDBOX_CLIENT_ID', + ], [ + 'value' => '', + 'type' => 'string', + 'description' => 'Your PayPal SANDBOX Client-ID used for testing ' + ]); + Settings::firstOrCreate([ + 'key' => 'SETTINGS::PAYMENTS:STRIPE:SECRET', + ], [ + 'value' => '', + 'type' => 'string', + 'description' => 'Your Stripe Secret-Key ( https://dashboard.stripe.com/account/apikeys )' + ]); + Settings::firstOrCreate([ + 'key' => 'SETTINGS::PAYMENTS:STRIPE:ENDPOINT_SECRET', + ], [ + 'value' => '', + 'type' => 'string', + 'description' => 'Your Stripe endpoint secret-key' + ]); + Settings::firstOrCreate([ + 'key' => 'SETTINGS::PAYMENTS:STRIPE:TEST_SECRET', + ], [ + 'value' => '', + 'type' => 'string', + 'description' => 'Your Stripe test secret-key' + ]); + Settings::firstOrCreate([ + 'key' => 'SETTINGS::PAYMENTS:STRIPE:ENDPOINT_TEST_SECRET', + ], [ + 'value' => '', + 'type' => 'string', + 'description' => 'Your Stripe endpoint test secret-key' + ]); + Settings::firstOrCreate([ + 'key' => 'SETTINGS::PAYMENTS:STRIPE:METHODS', + ], [ + 'value' => '', + 'type' => 'string', + 'description' => 'Comma seperated list of payment methods that are enabled (https://stripe.com/docs/payments/payment-methods/integration-options)' + ]); + + Settings::firstOrCreate([ + 'key' => 'SETTINGS::DISCORD:CLIENT_ID', + ], [ + 'value' => '', + 'type' => 'string', + 'description' => 'Discord API Credentials - https://discordapp.com/developers/applications/' + ]); + + Settings::firstOrCreate([ + 'key' => 'SETTINGS::DISCORD:CLIENT_SECRET', + ], [ + 'value' => '', + 'type' => 'string', + 'description' => 'Discord API Credentials - https://discordapp.com/developers/applications/' + ]); + Settings::firstOrCreate([ + 'key' => 'SETTINGS::DISCORD:BOT_TOKEN', + ], [ + 'value' => '', + 'type' => 'string', + 'description' => 'Discord API Credentials - https://discordapp.com/developers/applications/' + ]); + + Settings::firstOrCreate([ + 'key' => 'SETTINGS::DISCORD:GUILD_ID', + ], [ + 'value' => '', + 'type' => 'string', + 'description' => 'Discord API Credentials - https://discordapp.com/developers/applications/' + ]); + + Settings::firstOrCreate([ + 'key' => 'SETTINGS::DISCORD:ROLE_ID', + ], [ + 'value' => '', + 'type' => 'string', + 'description' => 'Discord role that will be assigned to users when they register' + ]); + Settings::firstOrCreate([ + 'key' => 'SETTINGS::DISCORD:INVITE_URL', + ], [ + 'value' => '', + 'type' => 'string', + 'description' => 'The invite URL to your Discord Server' + ]); + + Settings::firstOrCreate([ + 'key' => 'SETTINGS::SYSTEM:PTERODACTYL:TOKEN', + ], [ + 'value' => '', + 'type' => 'string', + 'description' => 'Admin API Token from Pterodactyl Panel - necessary for the Panel to work. The Key needs all read&write permissions!' + ]); + Settings::firstOrCreate([ + 'key' => 'SETTINGS::SYSTEM:PTERODACTYL:URL', + ], [ + 'value' => '', + 'type' => 'string', + 'description' => 'The URL to your Pterodactyl Panel. Must not end with a / ' + ]); + Settings::firstOrCreate([ + 'key' => 'SETTINGS::MISC:PHPMYADMIN:URL', + ], [ + 'value' => '', + 'type' => 'string', + 'description' => 'The URL to your PHPMYADMIN Panel. Must not end with a /, remove to remove database button' + ]); + + Settings::firstOrCreate([ + 'key' => 'SETTINGS::RECAPTCHA:SITE_KEY', + ], [ + 'value' => '6LeIxAcTAAAAAJcZVRqyHh71UMIEGNQ_MXjiZKhI', + 'type' => 'string', + 'description' => 'Google Recaptcha API Credentials - https://www.google.com/recaptcha/admin - reCaptcha V2 (not v3)' + ]); + + Settings::firstOrCreate([ + 'key' => 'SETTINGS::RECAPTCHA:SECRET_KEY', + ], [ + 'value' => '6LeIxAcTAAAAAGG-vFI1TnRWxMZNFuojJ4WifJWe', + 'type' => 'string', + 'description' => 'Google Recaptcha API Credentials - https://www.google.com/recaptcha/admin - reCaptcha V2 (not v3)' + ]); + Settings::firstOrCreate([ + 'key' => 'SETTINGS::RECAPTCHA:ENABLED', + ], [ + 'value' => 'true', + 'type' => 'boolean', + 'description' => 'Enables or disables the ReCaptcha feature on the registration/login page' + + ]); + Settings::firstOrCreate([ + 'key' => 'SETTINGS::MAIL:MAILER', + ], [ + 'value' => 'smtp', + 'type' => 'string', + 'description' => 'Selected Mailer (smtp, mailgun, sendgrid, mailtrap)' + ]); + Settings::firstOrCreate([ + 'key' => 'SETTINGS::MAIL:HOST', + ], [ + 'value' => 'localhost', + 'type' => 'string', + 'description' => 'Mailer Host Adress' + ]); + Settings::firstOrCreate([ + 'key' => 'SETTINGS::MAIL:PORT', + ], [ + 'value' => '1025', + 'type' => 'string', + 'description' => 'Mailer Server Port' + ]); + Settings::firstOrCreate([ + 'key' => 'SETTINGS::MAIL:USERNAME', + ], [ + 'value' => '', + 'type' => 'string', + 'description' => 'Mailer Username' + ]); + Settings::firstOrCreate([ + 'key' => 'SETTINGS::MAIL:PASSWORD', + ], [ + 'value' => '', + 'type' => 'string', + 'description' => 'Mailer Password' + ]); + Settings::firstOrCreate([ + 'key' => 'SETTINGS::MAIL:ENCRYPTION', + ], [ + 'value' => 'tls', + 'type' => 'string', + 'description' => 'Mailer Encryption (tls, ssl)' + ]); + Settings::firstOrCreate([ + 'key' => 'SETTINGS::MAIL:FROM_ADDRESS', + ], [ + 'value' => '', + 'type' => 'string', + 'description' => 'Mailer From Address' + ]); + Settings::firstOrCreate([ + 'key' => 'SETTINGS::MAIL:FROM_NAME', + ], [ + 'value' => env('APP_NAME', 'Controlpanel'), + 'type' => 'string', + 'description' => 'Mailer From Name' + ]); + } +} diff --git a/package-lock.json b/package-lock.json index 6999b351..e9cdc147 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,5 +1,5 @@ { - "name": "bitsec-dashboard", + "name": "controllpanelgg", "lockfileVersion": 2, "requires": true, "packages": { diff --git a/public/images/discord_logo.png b/public/images/discord_logo.png new file mode 100644 index 00000000..aa1b5e2e Binary files /dev/null and b/public/images/discord_logo.png differ diff --git a/resources/lang/de.json b/resources/lang/de.json index 6f02c68f..284f23ac 100644 --- a/resources/lang/de.json +++ b/resources/lang/de.json @@ -68,7 +68,7 @@ "User ID": "User-ID", "Server Creation Error": "Fehler beim erstellen des Servers", "Your servers have been suspended!": "Deine Server wurden pausiert", - "To automatically re-enable your server\/s, you need to purchase more credits.": "Um deine Server zu reaktivieren, musst du mehr Credits kaufen!", + "To automatically re-enable your server/s, you need to purchase more credits.": "Um deine Server zu reaktivieren, musst du mehr Credits kaufen!", "Purchase credits": "Credits kaufen", "If you have any questions please let us know.": "Solltest du weiter fragen haben, melde dich gerne beim Support!", "Regards": "mit freundlichen Grüßen", @@ -217,7 +217,7 @@ "A voucher can only be used one time per user. Uses specifies the number of different users that can use this voucher.": "Ein Gutschein kann von einem User nur einmal eingelöst werden. \"Benutzungen\" setzt die Anzahl an Usern die diesen Gutschein einlösen können.", "Max": "Max", "Expires at": "Läuft ab am", - "Used \/ Uses": "Benutzungen", + "Used / Uses": "Benutzungen", "Expires": "Ablauf", "Sign in to start your session": "Melde dich an um das Dashboard zu benutzen", "Password": "Passwort", @@ -287,7 +287,7 @@ "No nodes have been linked!": "Es wurde keine Nodes verknüpft", "No nests available!": "Keine Nests verfügbar", "No eggs have been linked!": "Es wurde keine Eggs verknüpft", - "Software \/ Games": "Software \/ Spiele", + "Software / Games": "Software / Spiele", "Please select software ...": "Bitte Software auswählen", "---": "---", "Specification ": "Spezifikation", @@ -350,5 +350,14 @@ "Notes": "Notizen", "Amount in words": "Betrag in Worten", "Please pay until": "Zahlbar bis", - "Account already exists on Pterodactyl. Please contact the Support!": "Der Account existiert bereits bei Pterodactyl. Kontaktiere den Support!" -} \ No newline at end of file + "Account already exists on Pterodactyl. Please contact the Support!": "Der Account existiert bereits bei Pterodactyl. Kontaktiere den Support!", + "de": "Deutsch", + "en": "Englisch", + "fr": "Französisch", + "cs": "Tschechisch", + "es": "Spanisch", + "hi": "Hindi", + "it": "Italienisch", + "pl": "Polnisch", + "zh": "Chinesisch" +} diff --git a/resources/lang/en.json b/resources/lang/en.json index 0a2c40ef..50f2126e 100644 --- a/resources/lang/en.json +++ b/resources/lang/en.json @@ -4,11 +4,12 @@ "api key has been removed!": "api key has been removed!", "Edit": "Edit", "Delete": "Delete", - "configuration has been updated!": "configuration has been updated!", "Store item has been created!": "Store item has been created!", "Store item has been updated!": "Store item has been updated!", "Product has been updated!": "Product has been updated!", "Store item has been removed!": "Store item has been removed!", + "Created at": "Created at", + "Error!": "Error!", "unknown": "unknown", "Pterodactyl synced": "Pterodactyl synced", "Your credit balance has been increased!": "Your credit balance has been increased!", @@ -16,6 +17,7 @@ "Your payment has been canceled!": "Your payment has been canceled!", "Payment method": "Payment method", "Invoice": "Invoice", + "Download": "Download", "Product has been created!": "Product has been created!", "Product has been removed!": "Product has been removed!", "Show": "Show", @@ -26,6 +28,7 @@ "Unsuspend": "Unsuspend", "Suspend": "Suspend", "Icons updated!": "Icons updated!", + "configuration has been updated!": "configuration has been updated!", "link has been created!": "link has been created!", "link has been updated!": "link has been updated!", "product has been removed!": "product has been removed!", @@ -80,7 +83,6 @@ "Check the docs for it here": "Check the docs for it here", "Causer": "Causer", "Description": "Description", - "Created at": "Created at", "Application API": "Application API", "Create": "Create", "Memo": "Memo", @@ -89,13 +91,6 @@ "Token": "Token", "Last used": "Last used", "Are you sure you wish to delete?": "Are you sure you wish to delete?", - "Edit Configuration": "Edit Configuration", - "Text Field": "Text Field", - "Cancel": "Cancel", - "Save": "Save", - "Configurations": "Configurations", - "Key": "Key", - "Value": "Value", "Nests": "Nests", "Sync": "Sync", "Active": "Active", @@ -118,6 +113,7 @@ "Locations": "Locations", "Eggs": "Eggs", "Last updated :date": "Last updated :date", + "Download all Invoices": "Download all Invoices", "Product Price": "Product Price", "Tax Value": "Tax Value", "Tax Percentage": "Tax Percentage", @@ -151,11 +147,15 @@ "Config": "Config", "Suspended at": "Suspended at", "Settings": "Settings", - "Dashboard icons": "Dashboard icons", - "Invoice Settings": "Invoice Settings", + "Key": "Key", + "Value": "Value", + "Edit Configuration": "Edit Configuration", + "Text Field": "Text Field", + "Cancel": "Cancel", + "Save": "Save", "Select panel icon": "Select panel icon", "Select panel favicon": "Select panel favicon", - "Download all Invoices": "Download all Invoices", + "Images and Icons may be cached, reload without cache to see your changes appear": "Images and Icons may be cached, reload without cache to see your changes appear", "Enter your companys name": "Enter your companys name", "Enter your companys address": "Enter your companys address", "Enter your companys phone number": "Enter your companys phone number", @@ -165,6 +165,15 @@ "Enter your custom invoice prefix": "Enter your custom invoice prefix", "Logo": "Logo", "Select Invoice Logo": "Select Invoice Logo", + "Available languages": "Available languages", + "Default language": "Default language", + "The fallback Language, if something goes wrong": "The fallback Language, if something goes wrong", + "Datable language": "Datable language", + "The Language of the Datatables. Grab the Language-Codes from here": "The Language of the Datatables. Grab the Language-Codes from here", + "Auto-translate": "Auto-translate", + "If this is checked, the Dashboard will translate itself to the Clients language, if available": "If this is checked, the Dashboard will translate itself to the Clients language, if available", + "Let the Client change the Language": "Let the Client change the Language", + "If this is checked, Clients will have the ability to manually change their Dashboard language": "If this is checked, Clients will have the ability to manually change their Dashboard language", "Store": "Store", "Currency code": "Currency code", "Checkout the paypal docs to select the appropriate code": "Checkout the paypal docs to select the appropriate code", @@ -242,7 +251,7 @@ "per month": "per month", "Out of Credits in": "Out of Credits in", "Home": "Home", - "Languages": "Languages", + "Language": "Language", "See all Notifications": "See all Notifications", "Redeem code": "Redeem code", "Profile": "Profile", @@ -280,7 +289,6 @@ "Re-Sync Discord": "Re-Sync Discord", "Save Changes": "Save Changes", "Server configuration": "Server configuration", - "Error!": "Error!", "Make sure to link your products to nodes and eggs.": "Make sure to link your products to nodes and eggs.", "There has to be at least 1 valid product for server creation": "There has to be at least 1 valid product for server creation", "No products available!": "No products available!", @@ -321,9 +329,6 @@ "Canceled ...": "Canceled ...", "Deletion has been canceled.": "Deletion has been canceled.", "Date": "Date", - "To": "To", - "From": "From", - "Pending": "Pending", "Subtotal": "Subtotal", "Payment Methods": "Payment Methods", "Amount Due": "Amount Due", @@ -350,5 +355,13 @@ "Notes": "Notes", "Amount in words": "Amount in words", "Please pay until": "Please pay until", - "Account already exists on Pterodactyl. Please contact the Support!": "Account already exists on Pterodactyl. Please contact the Support!" -} \ No newline at end of file + "fr": "French", + "cs": "Czech", + "en": "English", + "es": "Spanish", + "de": "German", + "hi": "Hindi", + "it": "Italian", + "pl": "Polish", + "zh": "Chinese" +} diff --git a/resources/views/admin/configurations/editModel.blade.php b/resources/views/admin/configurations/editModel.blade.php deleted file mode 100644 index d8dc1376..00000000 --- a/resources/views/admin/configurations/editModel.blade.php +++ /dev/null @@ -1,63 +0,0 @@ - - - - diff --git a/resources/views/admin/configurations/index.blade.php b/resources/views/admin/configurations/index.blade.php deleted file mode 100644 index bed5435f..00000000 --- a/resources/views/admin/configurations/index.blade.php +++ /dev/null @@ -1,91 +0,0 @@ -@extends('layouts.main') - -@section('content') - -
-
-
-
-

{{__('Configurations')}}

-
- -
-
-
- - - -
-
- -
- -
-
-
{{__('Configurations')}}
-
-
- -
- - - - - - - - - - - - - - -
{{__('Key')}}{{__('Value')}}{{__('Type')}}{{__('Description')}}{{__('Created at')}}
- -
-
- - -
- - -
- - - @include('admin.configurations.editModel') - - - - - -@endsection diff --git a/resources/views/admin/payments/index.blade.php b/resources/views/admin/payments/index.blade.php index f37485ea..de1fc9c1 100644 --- a/resources/views/admin/payments/index.blade.php +++ b/resources/views/admin/payments/index.blade.php @@ -27,6 +27,10 @@
{{ __('Payments') }}
+
@@ -43,6 +47,7 @@ {{ __('Payment ID') }} {{ __('Payment Method') }} {{ __('Created at') }} + @@ -78,6 +83,7 @@ {data: 'payment_id'}, {data: 'payment_method'}, {data: 'created_at'}, + {data: 'actions' , sortable : false}, ], fnDrawCallback: function(oSettings) { $('[data-toggle="popover"]').popover(); diff --git a/resources/views/admin/settings/index.blade.php b/resources/views/admin/settings/index.blade.php index e3ecb1c3..5941c483 100644 --- a/resources/views/admin/settings/index.blade.php +++ b/resources/views/admin/settings/index.blade.php @@ -6,13 +6,13 @@
-

{{__('Settings')}}

+

{{ __('Settings') }}

@@ -28,7 +28,7 @@
-
{{__('Settings')}}
+
{{ __('Settings') }}
@@ -36,169 +36,18 @@
-
-
- @csrf - @method('PATCH') - -
-
-
-
- - -
- @error('icon') - - {{$message}} - - @enderror -
-
-
- - -
- @error('favicon') - - {{$message}} - - @enderror -
-
-
- - -
- -

Images and Icons may be cached, use CNTRL + F5(google - chrome hotkey) to reload without cache to see your changes appear :)

- -
- -
- - -
- @csrf - @method('PATCH') - -
-
- -
-
- - -
-
- -
-
- - -
-
- -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- -
-
- - -
-
- - -
-
- - -
-
- - -
-
- -
- - -
-
- @error('logo') - - {{$message}} - - @enderror -
-
-
- - - -
+ @foreach ($tabs as $tab) + @include($tab) + @endforeach
@@ -218,12 +67,25 @@ diff --git a/resources/views/admin/settings/tabs/invoices.blade.php b/resources/views/admin/settings/tabs/invoices.blade.php new file mode 100644 index 00000000..27faef7c --- /dev/null +++ b/resources/views/admin/settings/tabs/invoices.blade.php @@ -0,0 +1,111 @@ +
+ + @csrf + @method('PATCH') + +
+
+ +
+
+ + +
+
+ +
+
+ + +
+
+ +
+
+ + +
+
+ + +
+
+ + +
+
+
+ +
+ +
+
+ + +
+
+ +
+
+ + +
+
+ + +
+
+ + +
+
+
+
+
+
+
+ + +
+
+
+ +
+
+ +
+ + +
+
+ @error('logo') + + + @enderror +
+
+
+ +
+ +
+ +
diff --git a/resources/views/admin/settings/tabs/language.blade.php b/resources/views/admin/settings/tabs/language.blade.php new file mode 100644 index 00000000..97617199 --- /dev/null +++ b/resources/views/admin/settings/tabs/language.blade.php @@ -0,0 +1,91 @@ +
+
+ @csrf + @method('PATCH') + +
+
+
+ +
+ + +
+ + + +
+ + + +
+ +
+ + + +
+
+
+ + +
+ + +
+ + + +
+ + + + + +
+
+
+
+ +
+
+
+ + diff --git a/resources/views/admin/settings/tabs/misc.blade.php b/resources/views/admin/settings/tabs/misc.blade.php new file mode 100644 index 00000000..6452881b --- /dev/null +++ b/resources/views/admin/settings/tabs/misc.blade.php @@ -0,0 +1,194 @@ +
+
+ @csrf + @method('PATCH') + +
+ + {{-- E-Mail --}} +
+
+
+

E-Mail

+
+
+ +
+ + +
+
+
+ + +
+
+
+
+ + +
+
+
+
+ + +
+
+
+
+ + +
+
+
+
+ + +
+
+
+
+ + +
+
+
+
+ + +
+
+
+ + +
+
+
+

Discord

+
+
+ +
+
+ + +
+
+ +
+
+ + +
+
+ +
+
+ + +
+
+ +
+
+ + +
+
+ +
+
+ + +
+
+ +
+
+ + +
+
+ +
+
+
+
+

ReCaptcha

+
+
+ +
+
+
+ + +
+
+
+ +
+
+ + +
+
+ +
+
+ + +
+
+
+ + +
+
+ +
+
+
diff --git a/resources/views/admin/settings/tabs/payment.blade.php b/resources/views/admin/settings/tabs/payment.blade.php new file mode 100644 index 00000000..125cc63e --- /dev/null +++ b/resources/views/admin/settings/tabs/payment.blade.php @@ -0,0 +1,144 @@ +
+
+ @csrf + @method('PATCH') + +
+ {{-- PayPal --}} +
+
+
+

PayPal

+
+
+ +
+
+ + +
+
+ +
+
+ + +
+
+ + +
+
+ + ({{ __('optional') }}) + +
+
+ +
+
+ + ({{ __('optional') }}) + +
+
+
+ + {{-- Stripe --}} +
+ +
+
+

Stripe

+
+
+
+
+ + +
+
+
+
+ + +
+
+ +
+
+ + ({{ __('optional') }}) + +
+
+ +
+
+ + ({{ __('optional') }}) + +
+
+
+
+
+ + +
+ +
+
+
+ + {{-- Other --}} +
+
+
+

Other

+
+
+ +
+
+
+ + +
+ +
+
+
+
+
+ +
+
+
diff --git a/resources/views/admin/settings/tabs/system.blade.php b/resources/views/admin/settings/tabs/system.blade.php new file mode 100644 index 00000000..e8524463 --- /dev/null +++ b/resources/views/admin/settings/tabs/system.blade.php @@ -0,0 +1,208 @@ +
+
+ @csrf + @method('PATCH') + +
+ {{-- System --}} +
+
+
+

{{ __('System') }}

+
+
+
+
+
+
+ + +
+ +
+
+
+
+
+ + +
+ +
+
+ +
+ + +
+
+
+ + +
+ +
+
+
+ + +
+ +
+
+
+ + +
+ +
+ +
+ +
+ + {{-- User --}} +
+
+
+

{{ __('User') }}

+
+
+
+
+ + +
+
+ + +
+ +
+ + +
+
+ + +
+
+ + +
+ +
+ + +
+
+ + +
+
+ + +
+
+
+ + {{-- Server --}} +
+
+
+

{{ __('Server') }}

+
+
+
+
+
+ + +
+ +
+
+
+
+ + +
+ @error('icon') + + {{ $message }} + + @enderror + + +
+
+ + +
+ @error('favicon') + + {{ $message }} + + @enderror +
+
+
+
+
+ +
+
+
diff --git a/resources/views/layouts/app.blade.php b/resources/views/layouts/app.blade.php index 0922c3bc..4f3bae60 100644 --- a/resources/views/layouts/app.blade.php +++ b/resources/views/layouts/app.blade.php @@ -1,5 +1,6 @@ + @@ -8,7 +9,9 @@ {{ config('app.name', 'Laravel') }} - + @@ -17,27 +20,32 @@ - - - - {!! htmlScriptTagJsApi() !!} + + + + @if (config('SETTINGS::RECAPTCHA:ENABLED') == 'true') + {!! htmlScriptTagJsApi() !!} + @endif @yield('content') + diff --git a/resources/views/layouts/main.blade.php b/resources/views/layouts/main.blade.php index ab4179ef..dd117f0d 100644 --- a/resources/views/layouts/main.blade.php +++ b/resources/views/layouts/main.blade.php @@ -32,6 +32,7 @@ + @@ -53,7 +54,6 @@ -
+ + + @endif @@ -230,7 +230,7 @@ - @if ((env('PAYPAL_SECRET') && env('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') -
+ + {{-- --}} + {{-- --}} + {{-- --}} + {{-- --}} + + + + + + + + + + + + + + + +