2025-12-15 11:03:30 +05:30
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace App\Models;
|
|
|
|
|
|
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
|
|
|
|
|
|
|
|
class ChatMessage extends Model
|
|
|
|
|
{
|
|
|
|
|
use HasFactory;
|
|
|
|
|
|
|
|
|
|
protected $fillable = [
|
|
|
|
|
'ticket_id',
|
|
|
|
|
'sender_id',
|
|
|
|
|
'sender_type',
|
|
|
|
|
'message',
|
|
|
|
|
'file_path',
|
|
|
|
|
'file_type',
|
|
|
|
|
'read_by_admin',
|
|
|
|
|
'read_by_user',
|
2025-12-17 19:49:14 +05:30
|
|
|
'client_id',
|
2025-12-15 11:03:30 +05:30
|
|
|
];
|
|
|
|
|
/**
|
|
|
|
|
* The ticket this message belongs to.
|
|
|
|
|
*/
|
|
|
|
|
public function ticket()
|
|
|
|
|
{
|
|
|
|
|
return $this->belongsTo(SupportTicket::class, 'ticket_id');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Polymorphic sender (User or Admin)
|
|
|
|
|
*/
|
|
|
|
|
public function sender()
|
|
|
|
|
{
|
|
|
|
|
return $this->morphTo();
|
|
|
|
|
}
|
|
|
|
|
}
|