<?php

namespace App\Models;

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

class Farm extends Model
{
    use HasFactory;
    protected $table = 'farm';

    protected $fillable = [
    
        'address',
        'postcode',
        'registration_no',
        'login_id',
    ];

    public function farm_section()
    {
        return $this->hasMany(Farm_section::class, 'id_farm');
    }

    public function login()
    {
        return $this->belongsTo(Login::class, 'login_id');
    }

    public function sections()
    {
        return $this->hasMany(Farm_section::class, 'id_farm');
    }
}
