37 lines
1.1 KiB
PHP
37 lines
1.1 KiB
PHP
<?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('transactions', function (Blueprint $table) {
|
|
$table->id();
|
|
$table->foreignId('user_id')->constrained()->cascadeOnDelete();
|
|
$table->foreignId('barbershop_id')->constrained('barbershop')->cascadeOnDelete();
|
|
$table->foreignId('customer_id')->constrained()->cascadeOnDelete();
|
|
$table->foreignId('service_id')->constrained()->cascadeOnDelete();
|
|
$table->decimal('price', 8, 2);
|
|
$table->decimal('discount', 8, 2)->default(0);
|
|
$table->decimal('total', 9, 2);
|
|
$table->enum('payment_method', ['1', '2', '3'])->comment('1:Cash 2:Qris 3:Other');
|
|
$table->timestamps();
|
|
$table->softDeletes();
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Reverse the migrations.
|
|
*/
|
|
public function down(): void
|
|
{
|
|
Schema::dropIfExists('transactions');
|
|
}
|
|
};
|