47 lines
1.1 KiB
PHP
47 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
|
|
class alternatif extends Model
|
|
{
|
|
use HasFactory;
|
|
|
|
protected $table = 'alternatifs';
|
|
protected $primaryKey = 'id';
|
|
|
|
protected $fillable = [
|
|
'kode',
|
|
'nama',
|
|
'id_subkriteria',
|
|
'id_subkriteria',
|
|
'id_subkriteria',
|
|
'id_subkriteria',
|
|
'id_subkriteria',
|
|
'id_subkriteria',
|
|
'id_subkriteria',
|
|
'id_subkriteria',
|
|
'id_subkriteria',
|
|
'id_subkriteria',
|
|
|
|
];
|
|
protected $with = ['penduduk', 'datakriteria'];
|
|
|
|
public function penduduk():BelongsTo{
|
|
return $this->belongsTo(penduduk::class, 'id_penduduk');
|
|
}
|
|
public function datakriteria():BelongsTo{
|
|
return $this->belongsTo(datakriteria::class, 'id_kriteria');
|
|
}
|
|
public function datasubkriteria():BelongsTo{
|
|
return $this->belongsTo(datakriteria::class, 'id_subkriteria');
|
|
}
|
|
public function rangkings()
|
|
{
|
|
return $this->hasMany(Rangking::class);
|
|
}
|
|
}
|