Adam Wathan presents strategies for simplifying Laravel controllers by following the 'Never Write Custom Actions' (NWCA) rule. He demonstrates how to break down large controllers with many custom actions into smaller, more focused controllers that only use standard CRUD/REST actions. Through examples from a podcast management application, he shows how to model seemingly custom operations as standard resource actions by thinking creatively about your domain models and resources.
The speaker discusses how to write more declarative code in Laravel by refactoring common patterns found in controller actions. Using examples shared on Twitter as inspiration, he demonstrates how to transform verbose, imperative code into cleaner, more declarative alternatives using Laravel's built-in features like form requests, policies, mutators, and real-time facades. The talk focuses on practical refactoring techniques to reduce branching logic and improve code readability.
This talk discusses moving beyond basic CRUD operations in Laravel applications, focusing on better ways to structure code using domain-driven design principles. The speaker emphasizes using ubiquitous language that matches business requirements rather than database structures, separating read and write operations, and implementing more meaningful actions instead of simple CRUD operations. He shares examples from large-scale projects and demonstrates how to improve code organization using commands and events.