MIF_E31231392/app/Models/DataSoalModel.php

43 lines
798 B
PHP

<?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_lowongan_pekerjaan)) {
$model->id_lowongan_pekerjaan = Str::uuid();
}
});
}
}