lots of progress
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
Schema::create('subscriptions', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('name');
|
||||
$table->text('description');
|
||||
$table->decimal('price', 10, 2);
|
||||
$table->integer('duration_days');
|
||||
$table->json('features');
|
||||
$table->integer('min_score');
|
||||
$table->integer('verification_interval_minutes');
|
||||
$table->boolean('is_active')->default(true);
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('subscriptions');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
Schema::create('user_subscriptions', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('user_id')->constrained()->onDelete('cascade');
|
||||
$table->foreignId('subscription_id')->constrained()->onDelete('cascade');
|
||||
$table->timestamp('started_at');
|
||||
$table->timestamp('expires_at');
|
||||
$table->string('status')->default('active');
|
||||
$table->string('payment_id')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('user_subscriptions');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Models\Subscription;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class SubscriptionSeeder extends Seeder
|
||||
{
|
||||
public function run()
|
||||
{
|
||||
$subscriptions = [
|
||||
[
|
||||
'name' => 'Free',
|
||||
'description' => 'Basic access to free proxies',
|
||||
'price' => 0,
|
||||
'duration_days' => 30,
|
||||
'features' => [
|
||||
'Access to basic proxies',
|
||||
'Standard verification interval',
|
||||
'Basic support'
|
||||
],
|
||||
'min_score' => 50,
|
||||
'verification_interval_minutes' => 60,
|
||||
'is_active' => true
|
||||
],
|
||||
[
|
||||
'name' => 'Pro',
|
||||
'description' => 'Enhanced access to high-quality proxies',
|
||||
'price' => 9.99,
|
||||
'duration_days' => 30,
|
||||
'features' => [
|
||||
'Access to premium proxies',
|
||||
'Faster verification interval',
|
||||
'Priority support',
|
||||
'Higher minimum score',
|
||||
'API access'
|
||||
],
|
||||
'min_score' => 80,
|
||||
'verification_interval_minutes' => 30,
|
||||
'is_active' => true
|
||||
],
|
||||
[
|
||||
'name' => 'Enterprise',
|
||||
'description' => 'Full access to all premium features',
|
||||
'price' => 29.99,
|
||||
'duration_days' => 30,
|
||||
'features' => [
|
||||
'Access to all proxies',
|
||||
'Fastest verification interval',
|
||||
'24/7 priority support',
|
||||
'Highest minimum score',
|
||||
'API access',
|
||||
'Custom proxy filtering',
|
||||
'Dedicated support'
|
||||
],
|
||||
'min_score' => 90,
|
||||
'verification_interval_minutes' => 15,
|
||||
'is_active' => true
|
||||
]
|
||||
];
|
||||
|
||||
foreach ($subscriptions as $subscription) {
|
||||
Subscription::create($subscription);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user