<?php

namespace App\Models;

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

class PayrollItem extends Model
{
    use HasFactory, \App\Traits\HotelScopeTrait;

    protected $fillable = [
        'hotel_id',
        'payroll_run_id',
        'staff_id',
        'gross_salary',
        'allowances',
        'deductions',
        'net_salary',
        'status',
    ];

    public function run()
    {
        return $this->belongsTo(PayrollRun::class, 'payroll_run_id');
    }

    public function staff()
    {
        return $this->belongsTo(Staff::class, 'staff_id');
    }
}
