Skip to content

Commit

Permalink
Fixed sending notifications when testing environment
Browse files Browse the repository at this point in the history
  • Loading branch information
tabuna committed Mar 27, 2024
1 parent 74b8d3d commit 5072284
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 2 additions & 2 deletions app/Services/TelegramBot.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,9 @@ public function isSpam(?string $message, $userId = null): bool
/**
* Send notification to Telegram.
*/
public static function notificationToTelegram($exception): void
public static function notificationToTelegram(\Throwable $exception): void
{
if (Arr::has(['local', 'testing'], config('app.env'))) {
if (config('app.env') !== 'production') {
return;
}

Expand Down
4 changes: 3 additions & 1 deletion bootstrap/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,7 @@
]);
})
->withExceptions(function (Exceptions $exceptions) {
\App\Services\TelegramBot::notificationToTelegram($exceptions);
$exceptions->report(function (Throwable $e) {
\App\Services\TelegramBot::notificationToTelegram($e);
});
})->create();

0 comments on commit 5072284

Please sign in to comment.