<?php

namespace App\Models;

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

class Task extends Model
{
    use HasFactory;

    protected $table = 'task';
    protected $fillable = [
        'title',
        'description',
        'login_id',
        'task_assigned_to',
        'farm_id',
        'section_id'
    ];

    public function creator()
{
    return $this->belongsTo(User_Detail::class, 'login_id', 'id');
}

public function assignee()
{
    return $this->belongsTo(User_Detail::class, 'task_assigned_to', 'id');
}

public function farm()
{
    return $this->belongsTo(Farm::class, 'farm_id', 'id');
}

public function section()
{
    return $this->belongsTo(Farm_Section::class, 'section_id', 'id');
}

}
