<?php

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

class CreateCashTransferRequestsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('cash_transfer_requests', function (Blueprint $table) {
            $table->id();
            $table->string('branch_code',100)->nullable();
            $table->foreignId('branch_id')->references('id')->on('branches');
            $table->foreignId('currency_id')->references('id')->on('currencies');
            $table->foreignId('created_by')->references('id')->on('users');
            $table->foreignId('request_by')->references('id')->on('chart_of_accounts');
            $table->double('amount',20,2)->default(0.00);
            $table->date('date_request');
            $table->text('purpose')->nullable();
            $table->integer('status',)->default(1)->comment('1=Request,2=Waiting Approve,3=Approved, 4=Reject');
            $table->softDeletes();
            $table->timestamps();
        });
    }

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