0008-laravel-actions

Encapsulate Laravel domain operations in invokable action classes.

Updated Aug 23, 2026
One-click install
npx skills add https://github.com/MrJmpl3/codex_____data_____configuration --skill 0008-laravel-actions
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: 0008-laravel-actions
Source: https://github.com/MrJmpl3/codex_____data_____configuration/tree/main/skills/0008-laravel-actions
Command: npx skills add https://github.com/MrJmpl3/codex_____data_____configuration --skill 0008-laravel-actions

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

It solves the problem of scattered business logic across controllers, jobs, and listeners by making domain operations live in dedicated Laravel action classes.

Core Features & Use Cases

  • Invokable action classes with a single __invoke() entry point for consistent, composable domain behavior.
  • Transactional, stateless workflows that wrap database modifications in DB::transaction() to keep state changes reliable.
  • Action composition and guardrails where actions call other actions for workflows and validate domain rules before mutating data (including throwing domain exceptions).
  • Use cases: create/update business entities (including multi-step workflows), enforce domain constraints (e.g., cancellation rules), and coordinate side effects like notifications and external service calls from a domain-centric place.

Quick Start

Create an invokable action class (e.g., CreateOrderAction) that accepts your domain inputs, validates rules, performs model changes inside DB::transaction(), and returns the updated model.

Frequently Asked Questions about 0008-laravel-actions

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
What is the best way to centralize Laravel domain logic and prevent it from scattering across controllers?

The best way to centralize Laravel domain logic is using invokable action classes with a single __invoke() entry point. This pattern encapsulates domain operations, keeping business rules out of controllers and listeners for consistent behavior.

How do I structure a Laravel action to handle multi-step business workflows?

Structure multi-step Laravel workflows by composing dependency-injected actions. One action can call other actions to coordinate side effects, validate domain rules, and orchestrate complex multi-step business processes from a single domain-centric location.

How do I ensure reliable database mutations when updating business entities in Laravel actions?

Ensure reliable Laravel database mutations by wrapping model changes inside DB::transaction() within your action. This transactional approach keeps state changes reliable, especially when coordinating multiple side effects like notifications and external service calls.

Can I use dependency injection to compose Laravel actions for complex domain rules?

Yes, you can use dependency injection to compose Laravel actions. Injecting actions into other actions allows you to build complex domain workflows, enforce domain constraints, and coordinate side effects while maintaining a stateless, testable architecture.

When should I not use invokable action classes for Laravel business logic?

You should avoid using invokable action classes for trivial CRUD operations that do not require complex domain rules or multi-step workflows. If a controller method handles simple, direct model interactions without scattered logic, an action class may add unnecessary boilerplate.