forked from admin/services_core
big update base struktur tahap 1
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
|
||||
class WilayahKecamatan extends Model
|
||||
{
|
||||
protected $table = 'wilayah_kecamatan';
|
||||
|
||||
protected $fillable = ['kabupaten_id', 'kode', 'nama'];
|
||||
|
||||
public function kabupaten(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(WilayahKabupaten::class, 'kabupaten_id');
|
||||
}
|
||||
|
||||
public function desa(): HasMany
|
||||
{
|
||||
return $this->hasMany(WilayahDesa::class, 'kecamatan_id');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user