<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Str;

class DataSoalModel extends Model
{
    protected $table = 'soal';

    protected $primaryKey = 'id_soal';

    protected $keyType = 'string';

    public $incrementing = false;

    protected $fillable = [
        'pertanyaan',
        'jawaban_a',
        'jawaban_b',
        'jawaban_c',
        'jawaban_d',
        'jawaban_e',
        'jawaban_benar',
    ];

    protected $casts = [
        'id_soal' => 'string',
    ];

    protected static function boot()
    {
        parent::boot();
        static::creating(function ($model) {
            if (empty($model->id_soal)) {
                $model->id_soal = Str::uuid();
            }
        });
    }
    
}
