<?php

namespace App\Models;

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

class Materi extends Model
{
    use HasFactory;

    protected $table = 'materis';
    protected $primaryKey = 'id_materi';

    protected $fillable = [
        'id_mengajar',
        'judul_materi',
        'lampiran_materi',
        'deskripsi',
        'tanggal_upload',
    ];

    protected $casts = [
        'tanggal_upload' => 'datetime',
    ];

    public function mengajar()
    {
        return $this->belongsTo(Mengajar::class, 'id_mengajar', 'id_mengajar');
    }
}