belongsTo(Kriteria::class, 'kriteria_id'); } public function penilaians() { return $this->hasMany(Penilaian::class); } protected static function boot() { parent::boot(); static::saving(function ($model) { if ($model->bobot < 1 || $model->bobot > 4) { throw new \Exception('Nilai bobot harus berada di antara 1 dan 4.'); } }); } }