<?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 OrganisationAllowance extends Model
{
    use HasFactory;

    protected $fillable = [
        "org_id",
        "type",
        "name",
        "description",
        "added_by",
        "status",
        "is_default",
        "default_type",
        "is_exceptional",
        "start_date",
        "end_date",
        "slug",
        "is_taxable",
        "percentage_of"
    ];

    //Define Parents Relationships
    public function organisationEmployeeAllowance()
    {
        return $this->hasMany(OrganisationEmployeeAllowance::class);
    }

    //Define Child Relationships
    public function organisation()
    {
        return $this->belongsTo(Organisation::class);
    }
    public function users()
    {
        return $this->belongsTo(User::class, "added_by");
    }
}
