/
githubmirror
/
framework
Обзор
Документация
Войти
/
githubmirror
/
framework
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
13.x
src/Illuminate/Queue/Jobs/InspectedJob.php
50 строк
2 KB
Jack Bayliss
[13.x] Add queue to InspectedJob (#60374)
04 июн 2026, 18:32
Не верифицирован
04 июн 2026, 18:32
bfbf5cf
Код
Авторство
О чём код?
<?php namespace Illuminate\Queue\Jobs; use Illuminate\Support\Carbon; class InspectedJob { /** * Create a new inspected job instance. * * @param string|null $uuid The unique identifier for the job. * @param string|null $queue The name of the queue the job is on. * @param string|null $name The display name of the job. * @param int $attempts The number of times the job has been attempted. * @param array $payload * @param \Illuminate\Support\Carbon|null $createdAt The date and time the job was created. */ public function __construct( public readonly ?string $uuid, public readonly ?string $queue, public readonly ?string $name, public readonly int $attempts, public readonly array $payload = [], public readonly ?Carbon $createdAt = null, ) { } /** * Create a new instance from a raw job payload. * * @param string $payload The raw JSON job payload. * @param int|null $attempts The number of times the job has been attempted. * @param string|null $queue The name of the queue the job is on. * @return static */ public static function fromPayload(string $payload, ?int $attempts = null, ?string $queue = null): static { $decoded = json_decode($payload, true); return new static( uuid: $decoded['uuid'] ?? null, queue: $queue, name: $decoded['displayName'] ?? null, attempts: $attempts ?? $decoded['attempts'] ?? 0, payload: $decoded, createdAt: isset($decoded['createdAt']) ? Carbon::createFromTimestamp($decoded['createdAt']) : null, ); } }