����JFIF��x�x����'
Server IP : 66.29.137.217 / Your IP : 3.140.246.156 Web Server : LiteSpeed System : Linux premium294.web-hosting.com 4.18.0-513.11.1.lve.el8.x86_64 #1 SMP Thu Jan 18 16:21:02 UTC 2024 x86_64 User : gltevjme ( 1095) PHP Version : 7.0.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/gltevjme/cbt.gltechlimited.com/app/Models/ |
Upload File : |
<?php namespace App\Models; use App\Traits\SecureDeletes; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\SoftDeletes; use Illuminate\Support\Str; use Spatie\SchemalessAttributes\SchemalessAttributesTrait; class ExamSession extends Model { use HasFactory; use SchemalessAttributesTrait; use SoftDeletes; use SecureDeletes; /* |-------------------------------------------------------------------------- | GLOBAL VARIABLES |-------------------------------------------------------------------------- */ protected $guarded = []; protected $casts = [ 'starts_at' => 'datetime', 'ends_at' => 'datetime', 'completed_at' => 'datetime', 'exam_sections' => 'array', ]; protected $schemalessAttributes = [ 'results', ]; /* |-------------------------------------------------------------------------- | FUNCTIONS |-------------------------------------------------------------------------- */ protected static function booted() { static::creating(function ($category) { $category->attributes['code'] = Str::uuid(); }); } /* |-------------------------------------------------------------------------- | RELATIONS |-------------------------------------------------------------------------- */ public function exam() { return $this->belongsTo(Exam::class, 'exam_id'); } public function user() { return $this->belongsTo(User::class); } public function sections() { return $this->belongsToMany(ExamSection::class, 'exam_session_sections') ->withPivot('sno', 'name', 'status', 'section_id', 'starts_at', 'ends_at', 'total_time_taken', 'current_question', 'results'); } public function questions() { return $this->belongsToMany(Question::class, 'exam_session_questions') ->withPivot('status', 'exam_section_id', 'original_question', 'options', 'is_correct', 'time_taken', 'user_answer', 'correct_answer', 'marks_earned', 'marks_deducted') ->withTrashed(); } public function examSchedule() { return $this->belongsTo(ExamSchedule::class); } /* |-------------------------------------------------------------------------- | SCOPES |-------------------------------------------------------------------------- */ public function scopePending($query) { return $query->where('status', '=', 'started'); } /* |-------------------------------------------------------------------------- | ACCESSORS |-------------------------------------------------------------------------- */ /* |-------------------------------------------------------------------------- | MUTATORS |-------------------------------------------------------------------------- */ }