Your Laravel Models Aren’t the Problem. Hidden Workflows Are.

This title could be clearer and more informative.Try out Clickbait Shieldfor free (5 uses left this month).

Laravel applications often degrade in maintainability not from one bad decision but from many small ones — particularly when Eloquent models accumulate workflow logic alongside state. The key distinction is between methods that describe an object's state (appropriate for models) versus methods that coordinate application-wide work like HTTP calls, notifications, and database transactions (which belong in dedicated workflow classes). A focused action class like ShipOrder makes dependencies explicit, simplifies testing, and keeps models coherent. The post also warns against simply migrating bloat from fat models to fat actions — workflow classes should coordinate collaborators, not implement every detail themselves. The guiding rule: ask whether a method describes the object or coordinates the application.

7m read timeFrom codecraftdiary.com
Post cover image
Table of contents
Business Logic in Eloquent Models Is Not Automatically WrongWhen a Model Starts Coordinating the ApplicationGive the Workflow an Explicit HomeAvoid Building a Fat Action InsteadA Rule That Is Actually Useful
2.8K Impressions