<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;

class PayrollPeriod extends Model
{
    protected $fillable = [
        'name','start_date','end_date','payment_date','status','approved_by',
    ];

    protected $casts = [
        'start_date'  => 'date',
        'end_date'    => 'date',
        'payment_date'=> 'date',
    ];

    public function records()  { return $this->hasMany(PayrollRecord::class, 'period_id'); }
    public function approver() { return $this->belongsTo(User::class, 'approved_by'); }
}
