/
githubmirror
/
framework
Обзор
Документация
Войти
/
githubmirror
/
framework
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
13.x
src/Illuminate/Queue/Middleware/Release.php
52 строки
1 KB
Jimmy Raphaël (Iharena)
Add `Release` queue middleware (#60630)
02 июл 2026, 04:02
Не верифицирован
02 июл 2026, 04:02
f6bad73
Код
Авторство
О чём код?
<?php namespace Illuminate\Queue\Middleware; use Closure; class Release { /** * @param bool $release Whether the job should be released back onto the queue. * @param int $releaseAfter The number of seconds before the job is available again. */ public function __construct( protected bool $release = false, protected int $releaseAfter = 0, ) { } /** * Release the job back onto the queue if the given condition is truthy. * * @param bool|(\Closure(): bool) $condition * @param int $releaseAfter The number of seconds before the job is available again. */ public static function when(Closure|bool $condition, int $releaseAfter = 0): static { return new static(value($condition), $releaseAfter); } /** * Release the job back onto the queue unless the given condition is truthy. * * @param bool|(\Closure(): bool) $condition * @param int $releaseAfter The number of seconds before the job is available again. */ public static function unless(Closure|bool $condition, int $releaseAfter = 0): static { return new static(! value($condition), $releaseAfter); } /** * Handle the job. */ public function handle(mixed $job, callable $next): mixed { if ($this->release) { return $job->release($this->releaseAfter); } return $next($job); } }