Skip to content

[12.x] Enum as queue overlap key#60722

Open
finagin wants to merge 2 commits into
laravel:12.xfrom
finagin:feature/enum-as-queue-overlap-key
Open

[12.x] Enum as queue overlap key#60722
finagin wants to merge 2 commits into
laravel:12.xfrom
finagin:feature/enum-as-queue-overlap-key

Conversation

@finagin

@finagin finagin commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

This PR allows using Enum as a key for middleware WithoutOverlapping

Note

The changes are fully backward compatible and do not disrupt existing applications.

namespace App\Enums;

enum Category
{
    case suit;
    case dress;
}
namespace App\Jobs;

use App\Enums\Category;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Queue\Queueable;
use Illuminate\Queue\Middleware\WithoutOverlapping;

class UpdateCategory implements ShouldQueue
{
    use Queueable;

    public function __construct(
        protected Category $category,
    ) {}

    public function middleware(): array
    {
        return [new WithoutOverlapping($this->category)];
    }

    public function __invoke(): void
    {
        // Some code
    }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant