50 lines
1.2 KiB
PHP
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
|
|
);
|
|
}
|
|
}
|