<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\HasOne;

class EmployeeDeduction extends Model
{
    use HasFactory;
    protected $with = ['deduction'];
    protected $table = 'employee_deductions';

    protected $fillable = [
        "org_id",
        "employee_id",
        "deduction_id",
        "value",
        "payroll_id",
        "is_annual",
        "start_date",
        "end_date"
    ];


    //Define Child Relationships
    public function user()
    {
        return $this->belongsTo(User::class, "employee_id");
    }

    public function deduction()
    {
        return $this->belongsTo(Deduction::class, "deduction_id");
    }

    // public function payroll()
    // {
    //     return $this->belongsTo(Payroll::class, "payroll_id");
    // }
}
