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
```
### Add some example products
This step is optional, only run this once
``` bash
php artisan db:seed --class=ExampleItemsSeeder --force
```
### Add The First User
``` bash
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()
{
//initials
Configuration::create([
'key' => 'INITIAL_CREDITS',
Configuration::firstOrCreate([
'key' => 'INITIAL_CREDITS',
], [
'value' => '250',
'type' => 'integer',
]);
Configuration::create([
'key' => 'INITIAL_SERVER_LIMIT',
Configuration::firstOrCreate([
'key' => 'INITIAL_SERVER_LIMIT',
], [
'value' => '1',
'type' => 'integer',
]);
//verify email event
Configuration::create([
'key' => 'CREDITS_REWARD_AFTER_VERIFY_EMAIL',
Configuration::firstOrCreate([
'key' => 'CREDITS_REWARD_AFTER_VERIFY_EMAIL',
], [
'value' => '250',
'type' => 'integer',
]);
Configuration::create([
'key' => 'SERVER_LIMIT_REWARD_AFTER_VERIFY_EMAIL',
Configuration::firstOrCreate([
'key' => 'SERVER_LIMIT_REWARD_AFTER_VERIFY_EMAIL',
], [
'value' => '2',
'type' => 'integer',
]);
//verify discord event
Configuration::create([
Configuration::firstOrCreate([
'key' => 'CREDITS_REWARD_AFTER_VERIFY_DISCORD',
] , [
'value' => '375',
'type' => 'integer',
]);
Configuration::create([
'key' => 'SERVER_LIMIT_REWARD_AFTER_VERIFY_DISCORD',
Configuration::firstOrCreate([
'key' => 'SERVER_LIMIT_REWARD_AFTER_VERIFY_DISCORD',
], [
'value' => '2',
'type' => 'integer',
]);
Configuration::create([
'key' => 'DISCORD_VERIFY_COMMAND',
Configuration::firstOrCreate([
'key' => 'DISCORD_VERIFY_COMMAND',
], [
'value' => '!verify',
'type' => 'string',
]);
//other
Configuration::create([
'key' => 'MINIMUM_REQUIRED_CREDITS_TO_MAKE_SERVER',
Configuration::firstOrCreate([
'key' => 'MINIMUM_REQUIRED_CREDITS_TO_MAKE_SERVER',
], [
'value' => '50',
'type' => 'integer',
]);

View file

@ -15,8 +15,6 @@ class DatabaseSeeder extends Seeder
{
$this->call([
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([
'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,
'memory' => 64,
'disk' => 1000,
@ -25,7 +25,7 @@ class ProductSeeder extends Seeder
Product::create([
'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,
'memory' => 128,
'disk' => 2000,
@ -34,7 +34,7 @@ class ProductSeeder extends Seeder
Product::create([
'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,
'memory' => 256,
'disk' => 5000,

View file

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