- Upgrade Filament framework from v3 to v4 - Update all Filament resources and pages for v4 compatibility - Fix test suite to maintain 100% pass rate (321 tests passing) - Add visibility condition for ticket close action (only when not closed) - Update dependencies and build assets for new Filament version - Maintain backward compatibility while leveraging v4 improvements
37 lines
850 B
PHP
37 lines
850 B
PHP
<?php
|
|
|
|
namespace App;
|
|
|
|
use Log;
|
|
use Http;
|
|
use Exception;
|
|
|
|
trait NotifyMe
|
|
{
|
|
function sendTelegramNotification($message) {
|
|
$botToken = config('app.notify_tg_bot_token');
|
|
$chatId = config('app.notify_tg_chat_id');
|
|
|
|
if (!$botToken || !$chatId) {
|
|
Log::error('Telegram bot token or chat ID not configured');
|
|
return false;
|
|
}
|
|
|
|
$url = "https://api.telegram.org/bot{$botToken}/sendMessage";
|
|
|
|
$data = [
|
|
'chat_id' => $chatId,
|
|
'text' => $message,
|
|
'parse_mode' => 'HTML'
|
|
];
|
|
|
|
try {
|
|
$response = Http::post($url, $data);
|
|
return $response->successful();
|
|
} catch (Exception $e) {
|
|
Log::error('Failed to send Telegram notification: ' . $e->getMessage());
|
|
return false;
|
|
}
|
|
}
|
|
}
|