<?php

namespace App\Models\Pertanian;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use App\Models\Pertanian\Komoditas;
use App\Models\Pertanian\Lahan;
use App\Models\Profile;

class Tanaman extends Model
{
    use SoftDeletes;

    protected $table = 'map_tanaman';

    protected $fillable = [
        'nama',
        'komoditas_id',
        'profile_id',
        'lahan_id',
        'latitude',
        'longitude',
        'kondisi_tanaman',
        'created_by',
        'updated_by',
        'deleted_by',
    ];

    public function komoditas()
    {
        return $this->belongsTo(Komoditas::class, 'komoditas_id');
    }

    public function profile()
    {
        return $this->belongsTo(Profile::class, 'profile_id');
    }

    public function lahan()
    {
        return $this->belongsTo(Lahan::class, 'lahan_id');
    }
}
