diff --git a/app/Console/Commands/ServicesInit.php b/app/Console/Commands/ServicesInit.php index 56f4328..b5c8f21 100644 --- a/app/Console/Commands/ServicesInit.php +++ b/app/Console/Commands/ServicesInit.php @@ -3,7 +3,10 @@ namespace App\Console\Commands; use Illuminate\Console\Command; +use Illuminate\Support\Facades\Http; + use App\Models\Service; +use App\Http\Controllers\Supply; class ServicesInit extends Command { @@ -31,18 +34,12 @@ class ServicesInit extends Command parent::__construct(); } - /** - * Execute the console command. - * - * @return int - */ - public function handle() - { + + public function handle() { $this->youtube(); + $this->tiktok(); $this->instagram(); $this->twitter(); - $this->tiktok(); - } protected function youtube() { @@ -50,20 +47,21 @@ class ServicesInit extends Command $s->name = 'Unique Views'; $s->type = 'views'; $s->site = 'youtube'; - $s->supplier = 'smmkings'; - $s->supplier_id = 2997; $s->maximum = 500000; $s->minimum = 1000; $s->price = 750; $s->available = true; $s->save(); + $sup = Supply::smmworld( $s->id, 418); + $s->primary_supplier = $sup->id; + $s->save(); + /* $s = new Service; $s->name = 'Language Targeted Views'; $s->type = 'views'; $s->site = 'youtube'; - $s->supplier = 'smmkings'; $s->modifier = 'language'; $s->maximum = 100000; $s->minimum = 1000; @@ -77,7 +75,6 @@ class ServicesInit extends Command $s = new Service; $s->name = 'Location Targeted Views'; $s->site = 'youtube'; - $s->supplier = 'smmkings'; $s->modifier = 'location'; $s->maximum = 100000; $s->minimum = 1000; @@ -94,23 +91,29 @@ class ServicesInit extends Command $s = new Service; $s->name = 'Likes'; $s->site = 'youtube'; - $s->supplier = 'smmkings'; $s->maximum = 100000; $s->minimum = 50; $s->price = 850; $s->available = true; $s->save(); + $sup = Supply::smmworld($s->id, 385); + $s->primary_supplier = $sup->id; + $s->save(); + $s = new Service; $s->name = 'Comments'; $s->site = 'youtube'; - $s->supplier = 'smmkings'; $s->maximum = 500000; $s->minimum = 10; $s->price = 7500; $s->available = true; $s->save(); + $sup = Supply::smmkings($s->id, 3726); + $s->primary_supplier = $sup->id; + $s->save(); + } protected function instagram() { @@ -119,32 +122,34 @@ class ServicesInit extends Command $s->name = 'Likes with Profile Visits'; $s->type = 'likes'; $s->site = 'instagram'; - $s->supplier = 'smmkings'; - $s->supplier_id = 2997; $s->maximum = 500000; $s->minimum = 1000; $s->price = 700; $s->available = true; $s->save(); + $sup = Supply::smmkings($s->id, 2997); + $s->primary_supplier = $sup->id; + $s->save(); + $s = new Service; $s->name = 'Likes'; $s->type = 'likes'; $s->site = 'instagram'; - $s->supplier = 'smmkings'; - $s->supplier_id = 3775; $s->maximum = 50000; $s->minimum = 100; $s->price = 50; $s->available = true; $s->save(); + $sup = Supply::smmkings($s->id, 3775); + $s->primary_supplier = $sup->id; + $s->save(); + $s = new Service; $s->name = 'Post Impressions'; $s->type = 'impressions'; $s->site = 'instagram'; - $s->supplier = 'smmkings'; - $s->supplier_id = 618; $s->maximum = 1000000; $s->minimum = 100; $s->price = 100; @@ -152,42 +157,52 @@ class ServicesInit extends Command $s->description = 'Post impressions and visits'; $s->save(); + $sup = Supply::smmkings($s->id, 618); + $s->primary_supplier = $sup->id; + $s->save(); + $s = new Service; $s->name = 'Profile Visits'; $s->type = 'profile'; $s->site = 'instagram'; - $s->supplier = 'smmkings'; - $s->supplier_id = 2997; $s->maximum = 500000; $s->minimum = 100; $s->price = 100; $s->available = true; $s->save(); + $sup = Supply::smmkings($s->id, 2997); + $s->primary_supplier = $sup->id; + $s->save(); + $s = new Service; $s->name = 'Post Views'; $s->type = 'views'; $s->site = 'instagram'; - $s->supplier = 'smmkings'; - $s->supplier_id = 2840; $s->maximum = 10000000; $s->minimum = 100; $s->price = 50; $s->available = true; $s->save(); + $sup = Supply::smmkings($s->id, 2840); + $s->primary_supplier = $sup->id; + $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(); + $sup = Supply::smmkings($s->id, 3882); + $s->primary_supplier = $sup->id; + $s->save(); + } protected function twitter() { @@ -195,37 +210,44 @@ class ServicesInit extends Command $s->name = 'Video Views'; $s->type = 'views'; $s->site = 'twitter'; - $s->supplier = 'smmkings'; - $s->supplier_id = 287; $s->maximum = 1000000; $s->minimum = 100; $s->price = 90; $s->available = true; $s->save(); + $sup = Supply::smmkings($s->id, 287); + $s->primary_supplier = $sup->id; + $s->save(); + $s = new Service; $s->name = 'Impressions'; $s->type = 'impressions'; $s->site = 'twitter'; - $s->supplier = 'smmkings'; - $s->supplier_id = 288; $s->maximum = 1000000; $s->minimum = 100; $s->price = 700; $s->available = true; $s->save(); + $sup = Supply::smmkings($s->id, 288); + $s->primary_supplier = $sup->id; + $s->save(); + $s = new Service; $s->name = 'Followers'; $s->type = 'followers'; $s->site = 'twitter'; - $s->supplier = 'smmkings'; - $s->supplier_id = 3820; $s->maximum = 10000; $s->minimum = 10; $s->price = 600; $s->available = true; $s->save(); + + $sup = Supply::smmkings($s->id, 3820); + $s->primary_supplier = $sup->id; + $s->save(); + } @@ -234,39 +256,45 @@ class ServicesInit extends Command $s->name = 'Views'; $s->type = 'views'; $s->site = 'tiktok'; - $s->supplier = 'smmkings'; - $s->supplier_id = 3826; $s->maximum = 10000000; $s->minimum = 100; $s->price = 70; $s->available = true; $s->save(); + $sup = Supply::smmkings($s->id, 3826); + $s->primary_supplier = $sup->id; + $s->save(); + $s = new Service; $s->name = 'Likes'; $s->type = 'likes'; $s->site = 'tiktok'; - $s->supplier = 'smmkings'; - $s->supplier_id = 3935; $s->maximum = 100000; $s->minimum = 100; $s->price = 400; $s->available = true; $s->save(); + $sup = Supply::smmkings($s->id, 3935); + $s->primary_supplier = $sup->id; + $s->save(); + $s = new Service; $s->name = 'Followers'; $s->type = 'followers'; $s->site = 'tiktok'; - $s->supplier = 'smmkings'; - $s->supplier_id = 3934; $s->maximum = 100000; $s->minimum = 20; $s->price = 300; $s->available = true; $s->save(); - } + $sup = Supply::smmkings($s->id, 3934); + $s->primary_supplier = $sup->id; + $s->save(); } +} + diff --git a/app/Http/Controllers/Supply.php b/app/Http/Controllers/Supply.php new file mode 100644 index 0000000..6c1eb60 --- /dev/null +++ b/app/Http/Controllers/Supply.php @@ -0,0 +1,63 @@ + + config("services.$site.key"), 'action' => 'services']); + } + + public static function smmkings($service_id, $id) { + $services = Http::post(config("services.smmkings.link"), ['key' => + config("services.smmkings.key"), 'action' => 'services'])->json(); + + foreach ($services as $service) { + if ($service['service'] == $id){ + $s = new Supplier; + $s->service_id = $service_id; + $s->supplier = 'smmkings'; + $s->supplier_id = (int) $service['service']; + $s->supplier_name = $service['name']; + $s->min = (int) $service['min']; + $s->max = (int) $service['max']; + $s->cost = $service['rate'] * 100; + $s->save(); + return $s; + } + } + + } + + public static function smmworld($service_id, $id) { + $services = Http::post(config("services.smmworld.link"), ['key' => + config("services.smmworld.key"), 'action' => 'services']); + $services = $services['services']; + + foreach ($services as $service) { + if ($service['id'] == $id){ + $s = new Supplier; + $s->service_id = $service_id; + $s->supplier = 'smmworld'; + $s->supplier_id = $service['id']; + $s->supplier_name = $service['name']; + $s->min = $service['min']; + $s->max = $service['max']; + $s->cost = $service['price_per_k'] * 100; + $s->save(); + return $s; + } + } + } + +} diff --git a/app/Models/Referral.php b/app/Models/Referral.php new file mode 100644 index 0000000..8475a1b --- /dev/null +++ b/app/Models/Referral.php @@ -0,0 +1,17 @@ +hasMany(User::class); + } +} diff --git a/app/Models/Service.php b/app/Models/Service.php index 1e3a93b..920ee56 100644 --- a/app/Models/Service.php +++ b/app/Models/Service.php @@ -5,6 +5,7 @@ namespace App\Models; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; use App\Models\Order; +use App\Models\Supplier; class Service extends Model { @@ -18,4 +19,8 @@ class Service extends Model return $this->hasMany(Order::class); } + public function suppliers() { + return $this->hasMany(Supplier::class); + } + } diff --git a/app/Models/Supplier.php b/app/Models/Supplier.php new file mode 100644 index 0000000..45e784d --- /dev/null +++ b/app/Models/Supplier.php @@ -0,0 +1,18 @@ +belongsTo(Service::class); + } +} + diff --git a/config/services.php b/config/services.php index d4e6314..51f7f12 100644 --- a/config/services.php +++ b/config/services.php @@ -44,6 +44,20 @@ return [ 'pm' => [ 'account' => env('PM_ACCOUNT'), 'secret' => env('PM_SECRET'), - ] + ], + + 'smmkings' => [ + 'key' => env('SMM_KEY'), + 'link' => env('SMM_LINK'), + ], + 'getfans' => [ + 'key' => env('GETFANS_KEY'), + 'link' => env('GETFANS_LINK'), + ], + + 'smmworld' => [ + 'key' => env('SMMWORLD_KEY'), + 'link' => env('SMMWORLD_LINK'), + ] ]; 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 36fe8db..3381564 100644 --- a/database/migrations/2021_05_18_184617_create_services_table.php +++ b/database/migrations/2021_05_18_184617_create_services_table.php @@ -22,7 +22,7 @@ class CreateServicesTable extends Migration $table->string('site'); $table->string('note')->nullable(); $table->string('modifier')->default(''); - $table->unsignedInteger('primary_supplier'); + $table->unsignedInteger('primary_supplier')->nullable(); $table->integer('maximum'); $table->integer('minimum'); $table->integer('price'); diff --git a/database/migrations/2021_05_19_185302_create_orders_table.php b/database/migrations/2021_05_19_185302_create_orders_table.php index 2953ddf..41f9740 100644 --- a/database/migrations/2021_05_19_185302_create_orders_table.php +++ b/database/migrations/2021_05_19_185302_create_orders_table.php @@ -24,7 +24,7 @@ class CreateOrdersTable extends Migration $table->string('message')->nullable(); $table->bigInteger('remaining')->default(0); $table->enum('status', ['processing', 'pending', 'canceled', - 'refunded', 'completed', 'error']); + 'refunded', 'partial', 'completed', 'error']); $table->string('url'); }); } diff --git a/database/migrations/2021_06_23_145817_create_suppliers_table.php b/database/migrations/2021_06_23_145817_create_suppliers_table.php index 12e34f7..e1897a6 100644 --- a/database/migrations/2021_06_23_145817_create_suppliers_table.php +++ b/database/migrations/2021_06_23_145817_create_suppliers_table.php @@ -19,11 +19,13 @@ class CreateSuppliersTable extends Migration $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('supplier_id'); $table->integer('alternate_id')->nullable(); + $table->integer('min'); + $table->integer('max'); $table->integer('cost'); $table->integer('remaining')->nullable(); + $table->boolean('available')->default(true); $table->text('description')->default(''); }); } diff --git a/database/migrations/2021_06_24_135121_create_referrals_table.php b/database/migrations/2021_06_24_135121_create_referrals_table.php index ae43dea..6226490 100644 --- a/database/migrations/2021_06_24_135121_create_referrals_table.php +++ b/database/migrations/2021_06_24_135121_create_referrals_table.php @@ -13,12 +13,12 @@ class CreateReferralsTable extends Migration */ public function up() { - Schema::create('referrals', function (Blueprint $table) { + Schema::create('user_referrals', function (Blueprint $table) { $table->id(); $table->timestamps(); $table->string('name'); $table->string('email'); - $table->integer('rate')->default(25); //Percentage + $table->integer('rate')->default(10); //Percentage $table->integer('limit')->default(20000); //Total limit in cents $table->unsignedInteger('balance')->default(0); $table->unsignedInteger('total')->default(0); @@ -33,6 +33,6 @@ class CreateReferralsTable extends Migration */ public function down() { - Schema::dropIfExists('referals'); + Schema::dropIfExists('user_referrals'); } } diff --git a/resources/views/home.blade.php b/resources/views/home.blade.php index 54623a1..39b8937 100644 --- a/resources/views/home.blade.php +++ b/resources/views/home.blade.php @@ -198,7 +198,7 @@

- We accept Bitcoin, Litecoin, and other cryptocurrencies, as well as USD + We accept Debit/Credit or your choice of crytocurrency through our Payeer and Perfect Money payment providers.