
PK 
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::create('salary_components', function (Blueprint $table) {
$table->id();
/* =========================
| Component Identity
|=========================*/
$table->string('code')->unique(); // BASIC, HRA, PF_EE, PF_ER
$table->string('name'); // Basic Salary, House Rent Allowance
$table->enum('type', [
'Earning',
'Deduction',
'EmployerContribution'
]);
/* =========================
| Behaviour
|=========================*/
$table->boolean('is_statutory')->default(false);
$table->boolean('is_taxable')->default(true);
$table->boolean('is_part_of_ctc')->default(true);
/* =========================
| Applicability Controls
|=========================*/
$table->boolean('pf_applicable')->default(false);
$table->boolean('esi_applicable')->default(false);
$table->boolean('pt_applicable')->default(false);
/* =========================
| Calculation
|=========================*/
$table->enum('calculation_type', [
'Fixed', // Fixed amount
'Percentage', // % of Basic or Gross
'Formula' // Future extensibility
])->default('Fixed');
$table->string('percentage_of')->nullable();
// BASIC / GROSS (used if Percentage)
/* =========================
| Display / Ordering
|=========================*/
$table->integer('display_order')->default(0);
$table->boolean('is_active')->default(true);
$table->timestamps();
});
}
public function down(): void
{
Schema::dropIfExists('salary_components');
}
};


PK 99