<?php

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

return new class extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('travel_expense_logs', function (Blueprint $table) {
            $table->id();
            $table->foreignId('travel_expense_id')->constrained();
            $table->foreignId('expense_category_id')->constrained('income_expense_categories');
            $table->string('title')->nullable();
            $table->decimal('amount')->nullable()->default(0);
            $table->foreignId('file_id')->nullable()->constrained('uploads');
            $table->text('remark')->nullable();

            $table->foreignId('created_by')->nullable()->constrained('users');
            $table->foreignId('updated_by')->nullable()->constrained('users');
            $table->foreignId('company_id')->nullable()->default(1);
            $table->foreignId('branch_id')->nullable()->default(1);
            
            $table->timestamps();
        });
    }

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