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

class Attendance extends Model
{
    // "attendances" is wrong — the migration creates "attendance" (uncountable)
    protected $table = 'attendance';

    protected $fillable = [
        'employee_id','date','time_in','time_out',
        'hours_worked','status','notes','recorded_by',
    ];

    protected $casts = ['date' => 'date'];

    public function employee() { return $this->belongsTo(Employee::class); }
    public function recorder() { return $this->belongsTo(User::class, 'recorded_by'); }
}
