Add page visit Telegram notifications
Some checks failed
Tests / Laravel tests (pull_request) Failing after 6m57s
Some checks failed
Tests / Laravel tests (pull_request) Failing after 6m57s
This commit is contained in:
30
app/Jobs/NotifyTelegramAboutPageVisit.php
Normal file
30
app/Jobs/NotifyTelegramAboutPageVisit.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?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 NotifyTelegramAboutPageVisit implements ShouldQueue
|
||||
{
|
||||
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
||||
|
||||
/**
|
||||
* @param array<string, mixed> $visit
|
||||
*/
|
||||
public function __construct(
|
||||
protected array $visit,
|
||||
protected ?string $ip,
|
||||
protected ?string $userAgent,
|
||||
protected ?string $acceptLanguage
|
||||
) {}
|
||||
|
||||
public function handle(TelegramNotificationService $telegram): void
|
||||
{
|
||||
$telegram->notifyPageVisit($this->visit, $this->ip, $this->userAgent, $this->acceptLanguage);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user