Skill: Craft Queueable Action
"If every action needs a job wrapper, eliminate the wrapper."
The Standard
- Use Trait:
QueueableActionfromspatie/laravel-queueable-action. - Same Signature:
execute()stays the same. No job-specific code. - Queue via Static:
Action::onQueue()->execute($data). - Configure Inline: Chain
->onQueue('emails'),->delay(), etc.
The Anti-Patterns
| ❌ Don't | ✅ Do | Why |
|---|---|---|
| Job class per action | Action::onQueue() |
Eliminates boilerplate |
| Queue logic in action | Chain methods before execute | Single responsibility |
| Forget serialization | Use models/primitives only | Jobs serialize parameters |
Real-World Examples
See examples.md.