<?php

namespace App\Models;

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

class Mapel extends Model
{
    use HasFactory;

    protected $table = 'mata_pelajaran';
    protected $primaryKey = 'id_mapel';

    protected $guarded = ['id_mapel'];
    public function materi()
    {
        return $this->hasMany(Materi::class, 'id_mapel', 'id_mapel');
    }
    
    public function mengajar()
    {
        return $this->hasMany(Mengajar::class, 'id_mapel', 'id_mapel');
    }
}