<?php

namespace App\Models;

use Carbon\Carbon;
use Illuminate\Database\Eloquent\Model;

class ExamAnswer extends Model
{
    protected $fillable = [
        'user_id',
        'exam_id',
        'exam_question_id',
        'is_correct',
        'user_answer_option',
        'id'
    ];

    public function question()
    {
        return $this->belongsTo(ExamQuestion::class,'exam_question_id');
    }

    public function getCreatedAtAttribute($date)
    {
        return Carbon::parse($date)->format('Y-m-d h:i A');
    }
    public function getUpdatedAtAttribute($date)
    {
        return Carbon::parse($date)->format('Y-m-d h:i A');
    }
}
