How this command is triggered — by the user, by Claude, or both
Slash command
/superpowers-laravel:laravel-jobThe summary Claude sees in its command listing — used to decide when to auto-load this command
# Laravel Job Generator I'll help you create a queued job for background processing. ## Usage ## Basic Job ## Dispatching Jobs ## Job with Unique ID ## Job Middleware ## Testing Jobs What job would you like to create? 1. Tell me the job name and purpose 2. Describe what data it needs 3. I'll generate the job code
I'll help you create a queued job for background processing.
# Generate job
php artisan make:job ProcessPayment
# Generate job with queueable
php artisan make:job SendEmail --queued
// app/Jobs/SendWelcomeEmail.php
namespace App\Jobs;
use App\Mail\WelcomeEmail;
use App\Models\User;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
use Illuminate\Support\Facades\Mail;
class SendWelcomeEmail implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
public int $tries = 3;
public int $timeout = 30;
public function __construct(
public User $user
) {}
public function handle(): void
{
Mail::to($this->user)->send(new WelcomeEmail($this->user));
}
public function failed(\Throwable $exception): void
{
\Log::error('Failed to send welcome email', [
'user_id' => $this->user->id,
'error' => $exception->getMessage(),
]);
}
}
// Dispatch immediately
SendWelcomeEmail::dispatch($user);
// Dispatch with delay
SendWelcomeEmail::dispatch($user)->delay(now()->addMinutes(5));
// Dispatch at specific time
ProcessPayment::dispatch($payment)->delay(now()->addHours(2));
// Chain jobs
Bus::chain([
new ProcessOrder($order),
new SendConfirmationEmail($user),
new UpdateInventory($order),
])->dispatch();
// Batch jobs
Bus::batch([
new ProcessVideo($video1),
new ProcessVideo($video2),
])->then(function (Batch $batch) {
// All completed
})->catch(function (Batch $batch, \Throwable $e) {
// First failure
})->name('Process Videos')->dispatch();
use Illuminate\Bus\Batch;
class ProcessVideo implements ShouldQueue, ShouldBeUnique
{
use Queueable, SerializesModels;
public function __construct(public Video $video) {}
public function uniqueId(): string
{
return $this->video->id;
}
public function uniqueFor(): int
{
return 3600; // Lock for 1 hour
}
public function handle(): void
{
// Process video
}
}
use Illuminate\Support\Facades\RateLimiter;
class ProcessApiRequest implements ShouldQueue
{
public function middleware(): array
{
return [(new RateLimited('api'))->allow(10)];
}
public function handle(): void
{
// Process request
}
}
use App\Jobs\SendWelcomeEmail;
use App\Models\User;
use Illuminate\Support\Facades\Queue;
use Illuminate\Support\Facades\Mail;
/** @test */
public function it_queues_the_job()
{
Queue::fake();
$user = User::factory()->create();
dispatch(new SendWelcomeEmail($user));
Queue::assertPushed(SendWelcomeEmail::class);
}
/** @test */
public function it_sends_the_email()
{
Mail::fake();
$user = User::factory()->create();
dispatch_sync(new SendWelcomeEmail($user));
Mail::assertSent(WelcomeEmail::class);
}
What job would you like to create?
npx claudepluginhub makfly/superpowers-laravel/laravel-schedulingSchedules Laravel tasks safely by invoking the laravel:task-scheduling skill exactly as written.
/laravelBuilds, configures, and optimizes Laravel apps with Eloquent models, service layers, queues, events, broadcasting, Sanctum/Passport auth, and Pest tests. Supports API, auth, queue, model gen, optimization, upgrade, audit flags.
/taskGenerates background task code using ARQ (recommended), Celery, or Dramatiq, including task definitions, worker configuration, and cron scheduling.
/queue-setupRuns interactive wizard to set up Cloudflare Queues: creates queue via wrangler, configures producer/consumer bindings and DLQ in Worker, generates example code.
/implement-batch-processingImplements batch processing infrastructure with Bull/BullMQ job queues, progress tracking, transaction management, error recovery, and RESTful API endpoints for bulk operations.