<?php

namespace App\Models;

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

class Employee extends Model
{
    use HasFactory;

    public function department()
    {
        return $this->belongsTo(Department::class);
    }

    public function tasks()
    {
        return $this->belongsToMany(Task::class, 'employee_task');
    }

     // Many-to-Many relationship with Meeting
     public function meetings()
     {
         return $this->belongsToMany(Meeting::class, 'employee_meeting', 'employee_id', 'meeting_id');
     }

   
     public function todayAttendance()
     {
         return $this->hasOne(Attendance::class)->whereDate('created_at', now()->toDateString());
     }
}
