feat: 🔒️ readded missing configurations migration & fixed old paypal_products migration & added seeder descriptions
This commit is contained in:
parent
4ad5722e9c
commit
e79e38ee27
|
@ -52,57 +52,60 @@ class AppServiceProvider extends ServiceProvider
|
|||
});
|
||||
|
||||
|
||||
// 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]);
|
||||
//only run if app is not run in command line
|
||||
if (!$this->app->runningInConsole()) {
|
||||
// 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')]);
|
||||
}
|
||||
|
||||
// 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')]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateConfigurationsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('configurations', function (Blueprint $table) {
|
||||
$table->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');
|
||||
}
|
||||
}
|
|
@ -4,7 +4,7 @@ use Illuminate\Database\Migrations\Migration;
|
|||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddDisplayToCreditProductsTable extends Migration
|
||||
class AddDisplayToPayPalProductsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
|
@ -13,7 +13,7 @@ class AddDisplayToCreditProductsTable extends Migration
|
|||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('credit_products', function (Blueprint $table) {
|
||||
Schema::table('paypal_products', function (Blueprint $table) {
|
||||
$table->string('display');
|
||||
});
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ class AddDisplayToCreditProductsTable extends Migration
|
|||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('credit_products', function (Blueprint $table) {
|
||||
Schema::table('paypal_products', function (Blueprint $table) {
|
||||
$table->dropColumn('display');
|
||||
});
|
||||
}
|
|
@ -150,6 +150,7 @@ class SettingsSeeder extends Seeder
|
|||
], [
|
||||
'value' => 'false',
|
||||
'type' => 'boolean',
|
||||
'description' => 'Enables or disables the invoice feature for payments'
|
||||
]);
|
||||
//Invoice company name
|
||||
Settings::firstOrCreate([
|
||||
|
|
Loading…
Reference in a new issue