<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateCommissionsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('commissions', function (Blueprint $table) {
            $table->id();
            $table->foreignId('car_sale_id')->constrained('car_sales')->onDelete('cascade');
            $table->date('date');
            $table->decimal('buyer_commission', 10, 2);
            $table->decimal('seller_commission', 10, 2);
            $table->string('receiver_name');
            $table->string('registration_no');
            $table->string('buyer_name');
            $table->string('seller_name');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('commissions');
    }
}
