added better seeding for better update support

This commit is contained in:
AVMG20 2021-06-07 17:30:19 +02:00
parent d622c1f625
commit ef777e22ee
7 changed files with 76 additions and 21 deletions

View file

@ -118,6 +118,12 @@ command will setup the database tables and then add all of the Nests & Eggs that
php artisan migrate --seed --force php artisan migrate --seed --force
``` ```
### Add some example products
This step is optional, only run this once
``` bash
php artisan db:seed --class=ExampleItemsSeeder --force
```
### Add The First User ### Add The First User
``` bash ``` bash
php artisan make:user php artisan make:user

View file

@ -0,0 +1,21 @@
<?php
namespace Database\Seeders;
use App\Models\ApplicationApi;
use Illuminate\Database\Seeder;
class ApplicationApiSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
ApplicationApi::create([
'memo' => 'admin'
]);
}
}

View file

@ -15,53 +15,61 @@ class ConfigurationSeeder extends Seeder
public function run() public function run()
{ {
//initials //initials
Configuration::create([ Configuration::firstOrCreate([
'key' => 'INITIAL_CREDITS', 'key' => 'INITIAL_CREDITS',
], [
'value' => '250', 'value' => '250',
'type' => 'integer', 'type' => 'integer',
]); ]);
Configuration::create([ Configuration::firstOrCreate([
'key' => 'INITIAL_SERVER_LIMIT', 'key' => 'INITIAL_SERVER_LIMIT',
], [
'value' => '1', 'value' => '1',
'type' => 'integer', 'type' => 'integer',
]); ]);
//verify email event //verify email event
Configuration::create([ Configuration::firstOrCreate([
'key' => 'CREDITS_REWARD_AFTER_VERIFY_EMAIL', 'key' => 'CREDITS_REWARD_AFTER_VERIFY_EMAIL',
], [
'value' => '250', 'value' => '250',
'type' => 'integer', 'type' => 'integer',
]); ]);
Configuration::create([ Configuration::firstOrCreate([
'key' => 'SERVER_LIMIT_REWARD_AFTER_VERIFY_EMAIL', 'key' => 'SERVER_LIMIT_REWARD_AFTER_VERIFY_EMAIL',
], [
'value' => '2', 'value' => '2',
'type' => 'integer', 'type' => 'integer',
]); ]);
//verify discord event //verify discord event
Configuration::create([ Configuration::firstOrCreate([
'key' => 'CREDITS_REWARD_AFTER_VERIFY_DISCORD', 'key' => 'CREDITS_REWARD_AFTER_VERIFY_DISCORD',
] , [
'value' => '375', 'value' => '375',
'type' => 'integer', 'type' => 'integer',
]); ]);
Configuration::create([ Configuration::firstOrCreate([
'key' => 'SERVER_LIMIT_REWARD_AFTER_VERIFY_DISCORD', 'key' => 'SERVER_LIMIT_REWARD_AFTER_VERIFY_DISCORD',
], [
'value' => '2', 'value' => '2',
'type' => 'integer', 'type' => 'integer',
]); ]);
Configuration::create([ Configuration::firstOrCreate([
'key' => 'DISCORD_VERIFY_COMMAND', 'key' => 'DISCORD_VERIFY_COMMAND',
], [
'value' => '!verify', 'value' => '!verify',
'type' => 'string', 'type' => 'string',
]); ]);
//other //other
Configuration::create([ Configuration::firstOrCreate([
'key' => 'MINIMUM_REQUIRED_CREDITS_TO_MAKE_SERVER', 'key' => 'MINIMUM_REQUIRED_CREDITS_TO_MAKE_SERVER',
], [
'value' => '50', 'value' => '50',
'type' => 'integer', 'type' => 'integer',
]); ]);

View file

@ -15,8 +15,6 @@ class DatabaseSeeder extends Seeder
{ {
$this->call([ $this->call([
ConfigurationSeeder::class, ConfigurationSeeder::class,
ProductSeeder::class,
PaypalProductSeeder::class,
]); ]);
} }

View file

@ -0,0 +1,23 @@
<?php
namespace Database\Seeders;
use Illuminate\Database\Seeder;
class ExampleItemsSeeder extends Seeder
{
/**
* Seed the application's database.
*
* @return void
*/
public function run()
{
$this->call([
ProductSeeder::class,
PaypalProductSeeder::class,
ApplicationApiSeeder::class,
]);
}
}

View file

@ -16,7 +16,7 @@ class ProductSeeder extends Seeder
{ {
Product::create([ Product::create([
'name' => 'Starter', 'name' => 'Starter',
'description' => '64MB Ram, 1GB Disk, 1 Database, 140 credits p/m', 'description' => '64MB Ram, 1GB Disk, 1 Database, 140 credits monthly',
'price' => 140, 'price' => 140,
'memory' => 64, 'memory' => 64,
'disk' => 1000, 'disk' => 1000,
@ -25,7 +25,7 @@ class ProductSeeder extends Seeder
Product::create([ Product::create([
'name' => 'Standard', 'name' => 'Standard',
'description' => '128MB Ram, 2GB Disk, 2 Database, 210 credits p/m', 'description' => '128MB Ram, 2GB Disk, 2 Database, 210 credits monthly',
'price' => 210, 'price' => 210,
'memory' => 128, 'memory' => 128,
'disk' => 2000, 'disk' => 2000,
@ -34,7 +34,7 @@ class ProductSeeder extends Seeder
Product::create([ Product::create([
'name' => 'Advanced', 'name' => 'Advanced',
'description' => '256MB Ram, 5GB Disk, 5 Database, 280 credits p/m', 'description' => '256MB Ram, 5GB Disk, 5 Database, 280 credits monthly',
'price' => 280, 'price' => 280,
'memory' => 256, 'memory' => 256,
'disk' => 5000, 'disk' => 5000,

View file

@ -3,7 +3,6 @@
use App\Http\Controllers\Api\ServerController; use App\Http\Controllers\Api\ServerController;
use App\Http\Controllers\Api\UserController; use App\Http\Controllers\Api\UserController;
use App\Http\Controllers\Api\VerifyController; use App\Http\Controllers\Api\VerifyController;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Route; use Illuminate\Support\Facades\Route;
/* /*