﻿<?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 OrganisationEmployeeAllowance extends Model
{
    use HasFactory;
    protected $with = ['organisationAllowance'];
    protected $table = 'organisation_employee_allowances';

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


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