34 lines
757 B
PHP
34 lines
757 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
|
|
class perbandingank extends Model
|
|
{
|
|
use HasFactory;
|
|
|
|
protected $table = 'perbandinganks';
|
|
protected $primaryKey = 'id';
|
|
protected $appends = ['normalization_value'];
|
|
|
|
protected $fillable = [
|
|
'kriteria1',
|
|
'nilai_bobot',
|
|
'kriteria2',
|
|
|
|
];
|
|
|
|
protected $with = ['datakriteria'];
|
|
|
|
public function datakriteria():BelongsTo{
|
|
return $this->belongsTo(datakriteria::class, 'id_kriteria');
|
|
}
|
|
public function normalization() {
|
|
return $this->hasOne(normalisasik::class, 'kode_normalisasi');
|
|
}
|
|
|
|
}
|