setup wizard init

This commit is contained in:
carodej
2020-06-29 10:09:42 +02:00
parent a2dfc627a7
commit aedc98cc8b
44 changed files with 2756 additions and 866 deletions

View File

@@ -0,0 +1,12 @@
<?php
/** @var \Illuminate\Database\Eloquent\Factory $factory */
use App\Setting;
use Faker\Generator as Faker;
$factory->define(Setting::class, function (Faker $faker) {
return [
//
];
});

View File

@@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateSettingsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('settings', function (Blueprint $table) {
$table->bigIncrements('id');
$table->string('name')->unique();
$table->longText('value')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('settings');
}
}

View File

@@ -14,5 +14,6 @@ class DatabaseSeeder extends Seeder
$this->call(PaymentGatewaysSeeder::class);
$this->call(PlansSeeder::class);
$this->call(InvoicesSeeder::class);
$this->call(SettingSeeder::class);
}
}

View File

@@ -17,12 +17,5 @@ class PaymentGatewaysSeeder extends Seeder
'name' => 'Stripe',
'slug' => 'stripe',
]);
// Create PayPal default record
DB::table('payment_gateways')->insert([
'logo' => '/assets/images/paypal-logo-thumbnail.png',
'name' => 'Paypal',
'slug' => 'paypal',
]);
}
}

View File

@@ -0,0 +1,57 @@
<?php
use Illuminate\Database\Seeder;
class SettingSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
$columns = collect([
// Service Billing Info
['name' => 'billing_phone_number'],
['name' => 'billing_postal_code'],
['name' => 'billing_vat_number'],
['name' => 'billing_address'],
['name' => 'billing_country'],
['name' => 'billing_state'],
['name' => 'billing_city'],
['name' => 'billing_name'],
// General Settings
['name' => 'app_title'],
['name' => 'app_description'],
['name' => 'app_logo'],
['name' => 'app_favicon'],
['name' => 'google_analytics'],
['name' => 'contact_email'],
// Users
['name' => 'registration', 'value' => 1],
['name' => 'storage_limitation', 'value' => 1],
['name' => 'storage_default', 'value' => 1],
// Mail settings
['name' => 'mail_driver'],
['name' => 'mail_host'],
['name' => 'mail_port'],
['name' => 'mail_username'],
['name' => 'mail_password'],
['name' => 'mail_encryption'],
]);
$columns->each(function ($col) {
DB::table('settings')->insert([
'name' => $col['name'],
'value' => isset($col['value']) ? $col['value'] : null,
]);
});
}
}