<?php

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

class CreateTrxKasirTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('trx_kasir', function (Blueprint $table) {
            $table->id();
            $table->foreignId('users_id')->constrained('users')->onDelete('cascade');
            $table->foreignId('laundry_id')->constrained('laundry')->onDelete('cascade');
            $table->string('jam_buka');
            $table->string('jam_tutup')->nullable();
            $table->date('tgl_buka');
            $table->date('tgl_tutup')->nullable();
            $table->string('opening_balance')->default(0);
            $table->string('closing_balance')->default(0);
            $table->integer('total_transaksi')->nullable()->default(0);
            $table->boolean('is_active')->default(0);
            $table->timestamps();
        });
    }

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