laravel-jobs

📁 leeovery/claude-laravel 📅 Jan 24, 2026
24
总安装量
13
周安装量
#15212
全站排名
安装命令
npx skills add https://github.com/leeovery/claude-laravel --skill laravel-jobs

Agent 安装分布

claude-code 12
codex 10
opencode 10
gemini-cli 9
antigravity 9
cursor 8

Skill 文档

Laravel Jobs

Background jobs and event listeners: thin delegation layers to actions.

Core Concept

jobs-listeners.md – Job patterns:

  • Jobs as thin delegation layers
  • Queue configuration
  • Retry logic and timeouts
  • Unique jobs
  • Job middleware
  • Event listeners
  • When to use jobs vs sync actions

Pattern

final class ProcessOrderJob implements ShouldQueue
{
    use Dispatchable, Queueable;

    public function __construct(
        public readonly int $orderId,
    ) {}

    public function handle(ProcessOrderAction $action): void
    {
        $order = Order::findOrFail($this->orderId);

        $action($order);
    }

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

// Listener
final class SendOrderConfirmationListener
{
    public function handle(OrderPlaced $event): void
    {
        SendOrderConfirmationJob::dispatch($event->order->id);
    }
}

Jobs delegate to actions. Keep domain logic in actions, not jobs.