'array', 'image_size' => 'integer', 'image_width' => 'integer', 'image_height' => 'integer', 'total_questions' => 'integer', 'processed_questions' => 'integer', 'confidence_avg' => 'float', 'processed_at' => 'datetime', 'created_at' => 'datetime', 'updated_at' => 'datetime', ]; public function questions(): HasMany { return $this->hasMany(OCRQuestionResult::class, 'ocr_record_id', 'id'); } public function student() { return $this->belongsTo(Student::class, 'student_id', 'student_id'); } public function getStatusBadgeAttribute(): string { return match ($this->status) { 'pending' => '待处理', 'processing' => '处理中', 'completed' => '已完成', 'failed' => '失败', default => '未知', }; } public function getImageUrlAttribute(): string { if ($this->image_path && file_exists(public_path($this->image_path))) { return asset($this->image_path); } return ''; } public function getProgressPercentageAttribute(): int { if ($this->total_questions === 0) { return 0; } return intval(($this->processed_questions / $this->total_questions) * 100); } }