<?php

namespace App\Models;

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

class PesertaChallenge extends Model
{
    use HasFactory;

    protected $table = 'peserta_challenges'; 

    protected $primaryKey = 'id_peserta';

    protected $fillable = [
        'id_challenge',
        'id_siswa',
        'jawaban',
        'waktu_submit',
        'exp',
        'status',
    ];

    public function siswa()
    {
        return $this->belongsTo(Siswa::class, 'id_siswa', 'id_siswa'); 
    }

    public function challenge()
    {
        return $this->belongsTo(Challenge::class, 'id_challenge', 'id_challenge');
    }
}