<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use OwenIt\Auditing\Contracts\Auditable;
use OwenIt\Auditing\Auditable as AuditableTrait;

class Payroll extends Model implements Auditable
{
    use HasFactory, AuditableTrait;

    protected $fillable = [
        'reference_no',
        'payroll_date',
        'cut_off',
        'cut_off_start',
        'cut_off_end',
        'company_id',
        'dealership_id',
        'file',
        'pdf_file',
        'posted_by',
        'posted_at',
        'released_by',
        'released_at',
    ];

    public function company() {
        return $this->belongsTo(Company::class,'company_id');
    }
    public function dealership() {
        return $this->belongsTo(Dealership::class,'dealership_id');
    }
    public function summary() {
        return $this->hasMany(PayrollSummary::class,'payroll_id');
    }
}
