Files
cv-roberto/app/Jobs/NotifyTelegramAboutContactMessage.php
Roberto bbfc64031f
Some checks failed
Tests / Laravel tests (pull_request) Failing after 6m57s
Add page visit Telegram notifications
2026-06-03 23:19:06 +02:00

50 lines
1.2 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;
public function __construct(string $name, string $message, string $ip, string $userAgent, ?string $email = null, ?string $phone = null)
{
$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
);
}
}