MIF_E31220044/app/Models/Kriteria.php

28 lines
571 B
PHP

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Kriteria extends Model
{
protected $table = 'kriterias';
protected $primaryKey = 'id';
public $timestamps = false;
// Mapping kolom DB ke properti model
protected $fillable = ['nama', 'bobot', 'tipe'];
// accessor biar tetap bisa pakai $kriteria->weight dan $kriteria->type
public function getWeightAttribute()
{
return $this->attributes['Bobot'];
}
public function getTypeAttribute()
{
return $this->attributes['jenis'];
}
}