78 lines
1.7 KiB
PHP
78 lines
1.7 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class ClientCallNote extends Model
|
|
{
|
|
use HasFactory;
|
|
|
|
protected $fillable = [
|
|
'client_meeting_id',
|
|
'client_id',
|
|
'created_by',
|
|
'raw_transcript',
|
|
'live_notes',
|
|
'mom_content',
|
|
'summary',
|
|
'action_items',
|
|
'key_decisions',
|
|
'detected_sentiment',
|
|
'sentiment_breakdown',
|
|
'angry_analysis',
|
|
'emotion_details',
|
|
'todo_items',
|
|
'recording_path',
|
|
'recordings',
|
|
'emailed_at',
|
|
'emailed_to',
|
|
];
|
|
|
|
protected $casts = [
|
|
'action_items' => 'array',
|
|
'key_decisions' => 'array',
|
|
'sentiment_breakdown' => 'array',
|
|
'angry_analysis' => 'array',
|
|
'emotion_details' => 'array',
|
|
'todo_items' => 'array',
|
|
'recordings' => 'array',
|
|
'emailed_to' => 'array',
|
|
'emailed_at' => 'datetime',
|
|
];
|
|
|
|
/**
|
|
* Parent meeting.
|
|
*/
|
|
public function meeting()
|
|
{
|
|
return $this->belongsTo(ClientMeeting::class, 'client_meeting_id');
|
|
}
|
|
|
|
/**
|
|
* Parent client profile.
|
|
*/
|
|
public function client()
|
|
{
|
|
return $this->belongsTo(Client::class, 'client_id');
|
|
}
|
|
|
|
/**
|
|
* User who initiated or finalized this note.
|
|
*/
|
|
public function creator()
|
|
{
|
|
return $this->belongsTo(User::class, 'created_by');
|
|
}
|
|
|
|
/**
|
|
* Check if client expression was angry or frustrated.
|
|
*/
|
|
public function isAngry(): bool
|
|
{
|
|
return strtolower($this->detected_sentiment) === 'angry'
|
|
|| (!empty($this->angry_analysis) && ($this->angry_analysis['is_angry'] ?? false));
|
|
}
|
|
}
|