send staff message to telegram

This commit is contained in:
xiaomlove
2026-06-12 17:47:08 +07:00
parent e4cdb26c2f
commit fab32bf63d
7 changed files with 66 additions and 14 deletions
+13 -2
View File
@@ -2,8 +2,7 @@
namespace App\Models;
use App\Repositories\ToolRepository;
use Google\Service\Testing\ToolResultsExecution;
use App\Enums\ModelEventEnum;
class StaffMessage extends NexusModel
{
@@ -27,4 +26,16 @@ class StaffMessage extends NexusModel
return $this->belongsTo(User::class, 'answeredby');
}
public static function add(int $sender, string $subject, string $msg)
{
$record = self::query()->create([
'sender' => $sender,
'subject' => $subject,
'msg' => $msg,
'added' => now(),
]);
fire_event(ModelEventEnum::STAFF_MESSAGE_CREATED, $record);
return $record;
}
}