Files
cv-roberto/app/Jobs/NotifyTelegramAboutContactMessage.php
Roberto da4bdc6bf4
All checks were successful
Tests / Laravel tests (pull_request) Successful in 12m3s
Add proxy IP headers to Telegram notifications
2026-06-04 00:30:44 +02:00

61 lines
1.4 KiB
PHP

<?php
namespace App\Jobs;
use App\Services\TelegramNotificationService;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
class NotifyTelegramAboutContactMessage implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
protected string $name;
protected string $message;
protected string $ip;
protected string $userAgent;
protected ?string $email;
protected ?string $phone;
/**
* @param array<string, string|null> $ipHeaders
*/
public function __construct(
string $name,
string $message,
string $ip,
string $userAgent,
?string $email = null,
?string $phone = null,
protected array $ipHeaders = []
) {
$this->name = $name;
$this->message = $message;
$this->ip = $ip;
$this->userAgent = $userAgent;
$this->email = $email;
$this->phone = $phone;
}
public function handle(TelegramNotificationService $telegram): void
{
$telegram->notifyContactMessage(
$this->name,
$this->message,
$this->ip,
$this->userAgent,
$this->email,
$this->phone,
$this->ipHeaders
);
}
}