From 4c00da7719778d27d5d2f1550c2e67ab4aa66cb4 Mon Sep 17 00:00:00 2001 From: Immanuel Onyeka Date: Thu, 24 Jun 2021 11:23:48 -0400 Subject: [PATCH] Create suppliers and referral tables --- app/Console/Commands/ServicesInit.php | 23 ++++++++--- .../2014_10_12_000000_create_users_table.php | 1 + ...021_05_18_184617_create_services_table.php | 4 +- ...21_06_23_145817_create_suppliers_table.php | 40 +++++++++++++++++++ ...21_06_24_135121_create_referrals_table.php | 38 ++++++++++++++++++ 5 files changed, 98 insertions(+), 8 deletions(-) create mode 100644 database/migrations/2021_06_23_145817_create_suppliers_table.php create mode 100644 database/migrations/2021_06_24_135121_create_referrals_table.php diff --git a/app/Console/Commands/ServicesInit.php b/app/Console/Commands/ServicesInit.php index cfaeb35..56f4328 100644 --- a/app/Console/Commands/ServicesInit.php +++ b/app/Console/Commands/ServicesInit.php @@ -54,7 +54,7 @@ class ServicesInit extends Command $s->supplier_id = 2997; $s->maximum = 500000; $s->minimum = 1000; - $s->price = 600; + $s->price = 750; $s->available = true; $s->save(); @@ -107,7 +107,7 @@ class ServicesInit extends Command $s->supplier = 'smmkings'; $s->maximum = 500000; $s->minimum = 10; - $s->price = 2000; + $s->price = 7500; $s->available = true; $s->save(); @@ -175,6 +175,19 @@ class ServicesInit extends Command $s->price = 50; $s->available = true; $s->save(); + + $s = new Service; + $s->name = 'Followers'; + $s->type = 'followers'; + $s->site = 'instagram'; + $s->supplier = 'smmkings'; + $s->supplier_id = 3882; + $s->maximum = 100000; + $s->minimum = 10; + $s->price = 410; + $s->available = true; + $s->save(); + } protected function twitter() { @@ -198,7 +211,7 @@ class ServicesInit extends Command $s->supplier_id = 288; $s->maximum = 1000000; $s->minimum = 100; - $s->price = 500; + $s->price = 700; $s->available = true; $s->save(); @@ -210,7 +223,7 @@ class ServicesInit extends Command $s->supplier_id = 3820; $s->maximum = 10000; $s->minimum = 10; - $s->price = 400; + $s->price = 600; $s->available = true; $s->save(); } @@ -237,7 +250,7 @@ class ServicesInit extends Command $s->supplier_id = 3935; $s->maximum = 100000; $s->minimum = 100; - $s->price = 300; + $s->price = 400; $s->available = true; $s->save(); diff --git a/database/migrations/2014_10_12_000000_create_users_table.php b/database/migrations/2014_10_12_000000_create_users_table.php index 702dc14..5f383dd 100644 --- a/database/migrations/2014_10_12_000000_create_users_table.php +++ b/database/migrations/2014_10_12_000000_create_users_table.php @@ -25,6 +25,7 @@ class CreateUsersTable extends Migration $table->boolean('active')->default(true); $table->boolean('paying')->default(false); $table->unsignedBigInteger('credits')->default(0); + $table->integer('referral')->nullable(); $table->rememberToken(); $table->timestamps(); }); diff --git a/database/migrations/2021_05_18_184617_create_services_table.php b/database/migrations/2021_05_18_184617_create_services_table.php index 9460386..36fe8db 100644 --- a/database/migrations/2021_05_18_184617_create_services_table.php +++ b/database/migrations/2021_05_18_184617_create_services_table.php @@ -21,10 +21,8 @@ class CreateServicesTable extends Migration $table->string('type')->nullable(); $table->string('site'); $table->string('note')->nullable(); - $table->string('supplier')->nullable(); - $table->integer('supplier_id')->nullable(); - $table->string('supplier_link')->nullable(); $table->string('modifier')->default(''); + $table->unsignedInteger('primary_supplier'); $table->integer('maximum'); $table->integer('minimum'); $table->integer('price'); diff --git a/database/migrations/2021_06_23_145817_create_suppliers_table.php b/database/migrations/2021_06_23_145817_create_suppliers_table.php new file mode 100644 index 0000000..12e34f7 --- /dev/null +++ b/database/migrations/2021_06_23_145817_create_suppliers_table.php @@ -0,0 +1,40 @@ +id(); + $table->timestamps(); + $table->foreignId('service_id')->constrained(); + $table->string('supplier')->nullable(); + $table->string('supplier_name')->nullable(); + $table->string('supplier_link')->nullable(); + $table->integer('supplier_id')->nullable(); + $table->integer('alternate_id')->nullable(); + $table->integer('cost'); + $table->integer('remaining')->nullable(); + $table->text('description')->default(''); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('suppliers'); + } +} diff --git a/database/migrations/2021_06_24_135121_create_referrals_table.php b/database/migrations/2021_06_24_135121_create_referrals_table.php new file mode 100644 index 0000000..ae43dea --- /dev/null +++ b/database/migrations/2021_06_24_135121_create_referrals_table.php @@ -0,0 +1,38 @@ +id(); + $table->timestamps(); + $table->string('name'); + $table->string('email'); + $table->integer('rate')->default(25); //Percentage + $table->integer('limit')->default(20000); //Total limit in cents + $table->unsignedInteger('balance')->default(0); + $table->unsignedInteger('total')->default(0); + $table->boolean('active')->default(true); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('referals'); + } +}