<?php

namespace Portal\Mileage\Model;

use App\Models\User;

use Portal\Mileage\Model\Project;
use Portal\Mileage\Model\JenisKenderaan;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class Claim extends Model
{

    protected $fillable = [
        'user_id','claim_date', 'jenis_kenderaan_id', 'project_id', 'description',
        'distance_from', 'distance_to',
        'total_mileage', 'toll_amount', 'others_amount', 'others_description',
        'calculated_amount','penalty_amount', 'penalty_reason', 'total_claim_amount',
        'status',
    ];

    public function user()
    {
        return $this->belongsTo(User::class, 'user_id', 'id');
    }

    public function project()
    {
        return $this->belongsTo(Project::class, 'project_id', 'id', 'p_project_description');
    }

    public function jenisKenderaan()
    {
        return $this->belongsTo(JenisKenderaan::class, 'jenis_kenderaan_id', 'id');
    }
}

