Deploy: 2026-05-21 15:33:14
This commit is contained in:
35
backend/app/Models/MessageLog.php
Normal file
35
backend/app/Models/MessageLog.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Core\Security;
|
||||
|
||||
/**
|
||||
* MessageLog Model
|
||||
* Records every message sent or received with full payload encryption.
|
||||
*/
|
||||
class MessageLog extends BaseModel
|
||||
{
|
||||
protected string $table = 'messages_log';
|
||||
|
||||
/**
|
||||
* Securely log a new message
|
||||
*/
|
||||
public function logMessage(array $data)
|
||||
{
|
||||
if (!empty($data['contact_phone'])) {
|
||||
$data['contact_phone_hash'] = Security::blindIndex($data['contact_phone']);
|
||||
$data['contact_phone'] = Security::encrypt($data['contact_phone']);
|
||||
}
|
||||
|
||||
if (!empty($data['message_body'])) {
|
||||
$data['message_body'] = Security::encrypt($data['message_body']);
|
||||
}
|
||||
|
||||
if (!empty($data['media_url'])) {
|
||||
$data['media_url'] = Security::encrypt($data['media_url']);
|
||||
}
|
||||
|
||||
return $this->create($data);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user