<?php

namespace App\Models;

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

class BantaranSungaiModel extends Model
{
    use HasFactory;
    protected $table = 'bantaran_sungai';
    protected $primaryKey = 'uuid';
    protected $fillable = [
        'nama',
        'lat',
        'longs',
        'foto',
        'perangkat_id',
        'kecamatan_id',
        'created_at',
        'updated_at'
    ];
    
    public $timestamps = false;

    public function device()
    {
        return $this->belongsTo(DeviceModel::class,'perangkat_id');
    }

    public function kecamatan_dua() 
    {
        return $this->belongsTo(KecamatanModel::class,'kecamatan_id');
    }

    public function kecamatan()
    {
        return $this->belongsTo(KecamatanModel::class, 'kecamatan_id', 'uuid');
    }
}
