<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class Tugas extends Model
{
    use HasFactory;

    protected $fillable = [
        'jadwal_kuliah_id',
        'user_id',
        'judul',
        'deskripsi',
        'link_file',
        'tanggal_tenggat',
        'post_id',
    ];

    public function jadwalKuliah()
    {
        return $this->belongsTo(JadwalKuliah::class);
    }

    public function dosen()
    {
        return $this->belongsTo(User::class, 'user_id');
    }

    public function pengumpulan()
    {
        return $this->hasMany(TugasPengumpulan::class);
    }

    public function post()
    {
        return $this->belongsTo(ELearningPost::class, 'post_id');
    }
}
