migrant-web/database/migrations/2026_06_30_000000_create_plans_table.php

80 lines
2.6 KiB
PHP

<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use Illuminate\Support\Facades\DB;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('plans', function (Blueprint $table) {
$table->string('id')->primary();
$table->string('name');
$table->decimal('price', 8, 2);
$table->string('duration');
$table->json('features');
$table->string('status')->default('Active');
$table->integer('max_contact_people')->nullable();
$table->boolean('unlimited_contacts')->default(false);
$table->boolean('enable_job_apply')->default(false);
$table->timestamps();
});
// Seed default plans
DB::table('plans')->insert([
[
'id' => 'basic',
'name' => 'Basic Search',
'price' => 99.00,
'duration' => 'Monthly',
'features' => json_encode(['Browse 500+ workers', '10 Shortlists']),
'status' => 'Active',
'max_contact_people' => 10,
'unlimited_contacts' => false,
'enable_job_apply' => false,
'created_at' => now(),
'updated_at' => now(),
],
[
'id' => 'premium',
'name' => 'Premium Pass',
'price' => 199.00,
'duration' => 'Monthly',
'features' => json_encode(['Unlimited shortlisting', 'Direct messaging']),
'status' => 'Active',
'max_contact_people' => 50,
'unlimited_contacts' => false,
'enable_job_apply' => true,
'created_at' => now(),
'updated_at' => now(),
],
[
'id' => 'vip',
'name' => 'VIP Concierge',
'price' => 499.00,
'duration' => 'Monthly',
'features' => json_encode(['Dedicated Manager', '30-day replacement']),
'status' => 'Active',
'max_contact_people' => null,
'unlimited_contacts' => true,
'enable_job_apply' => true,
'created_at' => now(),
'updated_at' => now(),
],
]);
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('plans');
}
};