28 lines
448 B
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}";
|
|
}
|
|
}
|