model-events-observers-workflows

Implement Laravel model lifecycle workflows with explicit domain events and after-commit observers dispatching jobs.

Updated Feb 11, 2026
One-click install
npx skills add https://github.com/edstevo/standards --skill model-events-observers-workflows
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: model-events-observers-workflows
Source: https://github.com/edstevo/standards/tree/main/resources/boost/skills/model-events-observers-workflows
Command: npx skills add https://github.com/edstevo/standards --skill model-events-observers-workflows

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill provides a robust pattern for managing complex application workflows triggered by model state changes, ensuring that side effects like event dispatching and job queuing are handled reliably and after database transactions are committed.

Core Features & Use Cases

  • Explicit Domain Events: Encourages the use of specific, expressive events (e.g., fulfilled, cancelled) instead of generic ones (saved, updated).
  • After-Commit Observers: Ensures that observers only react to events once database changes are successfully committed, preventing issues with rolled-back transactions.
  • Decoupled Workflows: Separates model state persistence from side-effect orchestration, keeping models lean and workflows readable.
  • Use Case: When a user's order status changes from 'pending' to 'shipped', this skill ensures that an audit log is created, an email notification is sent to the customer, and an integration with a shipping provider is triggered, all in a transactionally safe manner.

Quick Start

Use the model-events-observers-workflows skill to implement a pattern where a PurchaseOrder model's accepted event triggers a timeline event recording and dispatches a SyncToErp job.

Frequently Asked Questions about model-events-observers-workflows

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

FAQPage Schema
How do I handle Laravel model side effects after database transactions are committed?

Model side effects are handled reliably after database transactions are committed by using after-commit observers, ensuring that event dispatching and job queuing only trigger once database changes are successfully saved.

What is the best way to orchestrate complex workflows triggered by Laravel model state changes?

The best way to orchestrate workflows from model state changes is decoupling side-effect orchestration from persistence using explicit domain events and after-commit observers, keeping models lean and workflows readable.

Why should I use explicit domain events instead of generic Laravel model events like saved or updated?

Explicit domain events like fulfilled or cancelled should be used instead of generic events like saved or updated to provide expressive, specific triggers for side effects, ensuring clear separation of concerns in workflow orchestration.

How do I send notifications and trigger integrations safely when an order status changes in Laravel?

Notifications and integrations are triggered safely on order status changes by dispatching background jobs through after-commit observers, ensuring transactional integrity if the database update rolls back.

Does this model events pattern work without any additional Laravel dependencies?

Yes, this model events pattern works without additional dependencies, implementing transactional integrity and workflow orchestration using standard Laravel events, observers, and job dispatching capabilities.

When should I avoid using model observers for workflow orchestration in Laravel?

You should avoid using standard model observers if your workflow requires side effects to execute immediately during the transaction, as this pattern strictly enforces after-commit execution to prevent issues with rolled-back database transactions.