Loading...
Loading...
Background jobs and event listeners for async processing. Use when working with queued jobs, background processing, events, or when user mentions jobs, queues, listeners, events, async processing.
npx skill4agent add leeovery/claude-laravel laravel-jobsfinal 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);
}
}