一键导入
jobs
Queueable units of work for background processing. Jobs handle queue configuration and failure handling — they delegate business logic to Actions or Services.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Queueable units of work for background processing. Jobs handle queue configuration and failure handling — they delegate business logic to Actions or Services.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
| name | jobs |
| description | Queueable units of work for background processing. Jobs handle queue configuration and failure handling — they delegate business logic to Actions or Services. |
| compatible_agents | ["architect","implement","refactor","review"] |
$tries, $backoff, $timeout, or queue selection.QUEUE_CONNECTION in .env).php artisan queue:work).app/Jobs/.ProcessInvoicePayment, SendWeeklyReport, ImportProductCsv.ShouldQueue for asynchronous jobs.Dispatchable, InteractsWithQueue, Queueable, SerializesModels.$queue, $tries, $backoff, $timeout).WithoutOverlapping, RateLimited, tenant/context middleware).handle() thin and delegate to an Action or Service.failed(Throwable $exception) for permanent failure handling.namespace App\Jobs;
use App\Actions\ProcessInvoicePayment;
use App\Models\Invoice;
use Illuminate\Support\Facades\Log;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
use Throwable;
class ProcessInvoicePaymentJob implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
public int $tries = 3;
public int $backoff = 60;
public int $timeout = 120;
public string $queue = 'invoices';
public function __construct(
private readonly Invoice $invoice,
) {}
public function handle(ProcessInvoicePayment $action): void
{
$action->execute($this->invoice);
}
public function failed(Throwable $exception): void
{
Log::error('Invoice payment job failed permanently.', [
'invoice_id' => $this->invoice->id,
'message' => $exception->getMessage(),
]);
}
}
// Dispatch from a controller
class InvoicePaymentController extends Controller
{
public function __invoke(Invoice $invoice): JsonResponse
{
ProcessInvoicePaymentJob::dispatch($invoice);
return new JsonResponse(['status' => 'queued'], 202);
}
}
// Dispatch from a listener
class QueueInvoicePayment
{
public function handle(InvoiceApproved $event): void
{
ProcessInvoicePaymentJob::dispatch($event->invoice)
->delay(now()->addMinutes(5));
}
}
// Synchronous dispatch for tests or strict inline flow
ProcessInvoicePaymentJob::dispatchSync($invoice);
// Backoff strategy examples
public int|array $backoff = 60; // fixed: retry every 60s
// public array $backoff = [10, 30, 90, 300]; // exponential-ish progression
// Job middleware example
public function middleware(): array
{
return [
new WithoutOverlapping("invoice:{$this->invoice->id}"),
];
}
// Chaining and batching examples
Bus::chain([
new PrepareInvoiceDataJob($invoiceId),
new ProcessInvoicePaymentJob($invoiceId),
])->dispatch();
Bus::batch([
new ImportLineItemJob($rowA),
new ImportLineItemJob($rowB),
])->dispatch();
handle() delegates business logic to an Action/Service.$tries, $backoff, $timeout, $queue) are explicit.failed() captures actionable context (IDs, error message, alert/log).handle() method instead of delegating to an Action or Service$tries, $backoff, or $timeout and relying on global queue defaultsfailed() method for jobs that process critical dataActions/SKILL.md — for the business logic jobs delegate toServices/SKILL.md — for complex orchestration delegated from jobsReadonly data containers with typed factory methods (`fromArray`, `fromModel`, `fromCollection`, `fromRequest`) used to pass structured data between application layers — especially for external API responses, Eloquent models, and service boundaries. Use this skill whenever creating, reviewing, or refactoring DTOs, Data Transfer Objects, value objects for inter-layer communication, or mapping payloads from APIs, models, or collections into typed PHP objects. Also trigger when the user mentions spatie/laravel-data alternatives, data mapping, or payload normalization in a Laravel context.
Eloquent model conventions for mass assignment, casts, relationship naming, activity logging, and mandatory model tests (CRUD + relations).
Single-purpose business logic classes that encapsulate one well-defined business operation. Actions are the primary location for business logic in Laravel applications, invoked from controllers, commands, or jobs.
Albatros accounting API integration via Saloon. Use when working with app/Services/Albatros/, AlbatrosConnector, or Albatros DTOs.
Laravel Blade template conventions covering components, output escaping, security, structure, and formatting.
Artisan console command classes that serve as the CLI entry point for operations. Commands validate input and delegate all business logic to Actions or Services.