<?php

namespace App\Models;

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

class DetailTestModel extends Model
{
    protected $table = 'detail_test';

    protected $primaryKey = 'id_detail_test';

    protected $keyType = 'string';

    public $incrementing = false;

    protected $fillable = [
        'id_detail_test',
        'id_soal',
        'id_test_sessions',
        'jawaban'
    ];

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

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