33 lines
517 B
PHP
33 lines
517 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class Rule extends Model
|
|
{
|
|
protected $fillable = [
|
|
'kode',
|
|
'gejala_id',
|
|
'penyakit_id',
|
|
'mb',
|
|
'md'
|
|
];
|
|
|
|
public function gejala()
|
|
{
|
|
return $this->belongsTo(Gejala::class);
|
|
}
|
|
|
|
public function penyakit()
|
|
{
|
|
return $this->belongsTo(Penyakit::class);
|
|
}
|
|
|
|
// Hitung Nilai CF
|
|
public function getCfAttribute()
|
|
{
|
|
return $this->mb - $this->md;
|
|
}
|
|
}
|