
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('payslips', function (Blueprint $table) {
$table->id();
$table->foreignId('employee_id')
->constrained('employees')
->cascadeOnDelete();
$table->foreignId('payroll_id')
->constrained('payrolls')
->cascadeOnDelete();
$table->unsignedTinyInteger('month');
$table->unsignedSmallInteger('year');
$table->string('file_path'); // stored PDF location
$table->timestamps();
$table->unique(
['employee_id', 'month', 'year'],
'emp_month_year_payslip_unique'
);
});
}
public function down(): void
{
Schema::dropIfExists('payslips');
}
};


PK 99