Back to the Learning!

Laracasts is packed full with over 1,000 lessons just like this one.

Sign up to get full access or log in to your account and sit back.

Published On May. 4th 2016

Whip Monstrous Code Into Shape: Consider Strategizing

Episode 9 Run Time 12:29

Download
Tutorials often illustrate the simplest possible path through your codebase to demonstrate a particular concept. But the truth is that, in real life, things can quickly become quite a bit more complicated. For example, imagine that your website allows users to sign up for subscriptions. The only problem is that, based upon the form request data, you'll need to execute this process in multiple ways. Sounds like you're going to have lots of conditionals in your controller, right? Well, maybe there's another option: strategies.