Actions, Policies, and the Art of Obvious Code
Fat Controllers Die Hard After extracting traits into services, the controllers were thinner, but still fat. A typical store() method in OrdersController did: Validate input Create the order Create...

Source: DEV Community
Fat Controllers Die Hard After extracting traits into services, the controllers were thinner, but still fat. A typical store() method in OrdersController did: Validate input Create the order Create related records Upload documents Send email notifications Fire events for audit trails Send chat notifications Redirect with flash message That's eight responsibilities in one method. When Claude looked at this controller to understand how orders work, it had to parse all eight concerns interleaved together. When it needed to build an API controller for the same operation, it would copy-paste the web controller and try to adapt it. Badly. The fix: Actions. The Action Pattern An Action is a single-purpose class with one public method: execute(). namespace App\Actions\Orders; class CreateOrderAction { public function __construct( private NotificationInterface $notifications, private AnalyticsService $analytics, ) {} public function execute(CreateOrderRequest $request, User $user): CreateOrderR