We'll discuss fat controllers, services, actions, dependency injection & more
👍 If You Enjoy This Video, Consider Hitting The Like Button!
🥁 Subscribe To Stay Notified For New Videos: https://www.youtube.com/adocasts?sub_...
Subscribe to Adocasts Plus to gain access to all our lessons and more!
https://adocasts.com/pricing
🧾 Find The Code For This Lesson Here: https://github.com/adocasts/controlle...
In this lesson, we'll dive deep into three different ways we can organize our code; fat controllers, services, and actions. We'll also discuss circular dependencies, static and non-static service methods, and dependency injection.
🕑 Chapters
00:00 - Objectives & Project Familiarity
01:02 - What Are Fat Controllers?
02:43 - Fat Controllers & Services with Static Methods
04:08 - Completing Our Fat Controller Store Method
06:28 - Testing Our Store Method
07:50 - Fat Controller Pros/Cons
08:34 - Switching To Services
08:49 - Non-Static Service Methods
09:52 - Services & Dependency Injection (DI)
11:30 - The Service Approach
14:20 - Completing Our Service Store Method
16:20 - Splitting Out Sub-Tasks with Services
17:08 - Testing Our Service Store Method
17:23 - Service Approach Pros/Cons
17:53 - Services & Circular Dependencies
20:15 - Switching To Actions
20:30 - What Is An Action?
21:55 - The Action Approach
23:34 - Completing Our Action Store Class
24:42 - Splitting Out Sub-Tasks with Actions
25:55 - Testing Our Action Store Class
26:48 - Action Approach Pros/Cons
27:17 - Wrapping Up & Other Potential Options
-------------------------Socials--------------------------
🕸️ Website: https://adocasts.com
🐦 Twitter: / adocasts
👍 GitHub: https://github.com/adocasts