32 lines
1.2 KiB
PHP
Executable File
32 lines
1.2 KiB
PHP
Executable File
<?php
|
|
|
|
use Illuminate\Database\Capsule\Manager as Capsule;
|
|
use Illuminate\Database\Schema\Blueprint;
|
|
|
|
class CreateAffiliatesTable
|
|
{
|
|
public function up()
|
|
{
|
|
if (!Capsule::schema()->hasTable('affiliates')) {
|
|
Capsule::schema()->create('affiliates', function (Blueprint $table) {
|
|
$table->bigIncrements('affiliates_id');
|
|
$table->string('affiliates_code')->unique();
|
|
$table->string('affiliates_name');
|
|
$table->string('affiliates_email')->unique();
|
|
$table->string('affiliates_phone')->nullable();
|
|
$table->text('affiliates_address')->nullable();
|
|
$table->string('affiliates_website')->nullable();
|
|
$table->decimal('affiliates_commission_rate', 5, 2)->default(10.00);
|
|
$table->decimal('affiliates_total_earned', 12, 2)->default(0.00);
|
|
$table->decimal('affiliates_total_paid', 12, 2)->default(0.00);
|
|
$table->enum('affiliates_status', ['active', 'pending', 'suspended'])->default('pending');
|
|
$table->timestamps();
|
|
});
|
|
}
|
|
}
|
|
|
|
public function down()
|
|
{
|
|
Capsule::schema()->dropIfExists('affiliates');
|
|
}
|
|
} |