mastercut/database/migrations/2024_11_18_172841_create_payrolls_table.php

39 lines
1.2 KiB
PHP
Executable File

<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('payrolls', function (Blueprint $table) {
$table->id();
$table->foreignId('user_id')->constrained()->cascadeOnDelete();
$table->foreignId('employee_id')->constrained('users')->cascadeOnDelete();
$table->foreignId('barbershop_id')->constrained('barbershop')->cascadeOnDelete();
$table->decimal('amount', 10, 2)->comment('Base salary');
$table->decimal('incentive', 10, 2);
$table->decimal('cut', 10, 2);
$table->decimal('shaving_result', 10, 2);
$table->decimal('percentage_shaving', 5, 2);
$table->decimal('total', 10, 2);
$table->text('description');
$table->timestamps();
$table->softDeletes();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('payrolls');
}
};