CRM/backend/app/Models/QualityReview.php

46 خطوط
1.2 KiB
PHP

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
class QualityReview extends Model
{
protected $fillable = [
'call_id', 'reviewer_id', 'agent_id', 'version', 'is_current',
'greeting_score', 'product_intro_score', 'needs_discovery_score',
'objection_handling_score', 'closing_score', 'crm_accuracy_score',
'follow_up_quality_score', 'overall_score',
'feedback', 'strengths', 'improvement_areas', 'tag', 'status', 'is_shared_with_agent',
'acknowledged_at', 'agent_response',
];
protected function casts(): array
{
return [
'is_shared_with_agent' => 'boolean',
'is_current' => 'boolean',
'version' => 'integer',
'strengths' => 'array',
'improvement_areas' => 'array',
'acknowledged_at' => 'datetime',
];
}
public function call(): BelongsTo
{
return $this->belongsTo(Call::class);
}
public function reviewer(): BelongsTo
{
return $this->belongsTo(User::class, 'reviewer_id');
}
public function agent(): BelongsTo
{
return $this->belongsTo(User::class, 'agent_id');
}
}