sls/app/Models/Interview.php
2026-07-20 21:50:30 +05:30

51 lines
1.0 KiB
PHP

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Interview extends Model
{
use HasFactory;
protected $fillable = [
'candidate_name',
'candidate_email',
'candidate_phone',
'temp_password',
'expires_at',
'language',
'status',
'assigned_interviewers',
'proctor_logs',
'submitted_code',
'submitted_language',
'code_output',
'recording_path',
'submission_unique_id',
'created_by',
];
protected $casts = [
'expires_at' => 'datetime',
'assigned_interviewers' => 'array',
'proctor_logs' => 'array',
];
public function creator()
{
return $this->belongsTo(User::class, 'created_by');
}
public function warnings()
{
return $this->hasMany(InterviewWarning::class, 'interview_id');
}
public function isExpired(): bool
{
return now()->greaterThan($this->expires_at);
}
}