MIF_E31231754/app/Models/wilayah.php

28 lines
448 B
PHP

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Wilayah extends Model
{
protected $table = 'wilayah';
protected $fillable = [
'dusun',
'rw',
'latitude',
'longitude',
];
public function warga()
{
return $this->hasMany(Warga::class);
}
public function getLabelAttribute(): string
{
return "Dusun {$this->dusun} - RW {$this->rw}";
}
}