<?php

namespace Modules\Travel\Entities;

use App\Models\Upload;
use App\Models\Traits\BranchTrait;
use App\Models\Traits\CompanyTrait;
use Illuminate\Foundation\Auth\User;
use Illuminate\Database\Eloquent\Model;
use Modules\Travel\Entities\TravelExpense;
use App\Models\Expenses\IncomeExpenseCategory;
use Illuminate\Database\Eloquent\Factories\HasFactory;

class TravelExpenseLog extends Model
{
    use HasFactory, CompanyTrait, BranchTrait;

   
    protected $fillable = [
        'travel_expense_id',
        'expense_category_id',
        'amount',
        'file_id',
        'remark',
        'created_by',
        'updated_by',
        'company_id',
        'branch_id',
    ];

    public function travelExpense()
    {
        return $this->belongsTo(TravelExpense::class);
    }

    public function expenseCategory()
    {
        return $this->belongsTo(IncomeExpenseCategory::class, 'expense_category_id');
    }

    public function file()
    {
        return $this->belongsTo(Upload::class, 'file_id');
    }

    public function createdBy()
    {
        return $this->belongsTo(User::class, 'created_by');
    }

    public function updatedBy()
    {
        return $this->belongsTo(User::class, 'updated_by');
    }
}
