49 lines
1022 B
PHP
49 lines
1022 B
PHP
<?php
|
|
|
|
namespace App\Models\Verifikator;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class LimitMengajar extends Model
|
|
{
|
|
use HasFactory;
|
|
|
|
protected $table = 'verifikator.limit_mengajars';
|
|
protected $fillable = [
|
|
'prodi_id',
|
|
'name',
|
|
'limit',
|
|
'limit_type',
|
|
'periode',
|
|
];
|
|
|
|
function prodi()
|
|
{
|
|
return $this->belongsTo(Prodi::class, 'prodi_id', 'id');
|
|
}
|
|
|
|
function unit()
|
|
{
|
|
return $this->belongsTo(UnitKerjaPegawai::class, 'prodi_id', 'id');
|
|
}
|
|
|
|
function jenjangs()
|
|
{
|
|
return $this->hasMany(LimitMengajarJenjang::class);
|
|
}
|
|
|
|
function tipeMks()
|
|
{
|
|
return $this->hasMany(LimitMengajarTipeMk::class);
|
|
}
|
|
|
|
protected static function booted(): void
|
|
{
|
|
$periode = Periode::where('status', true)->first()->id_periode;
|
|
static::creating(function ($model) use ($periode) {
|
|
$model->periode = $periode;
|
|
});
|
|
}
|
|
}
|