In the previous episode, we constructed multiple conditionals to determine which set of HTML should be displayed. For our basic example, the outcome was simple enough. However, for real-life projects, you may find that this quickly bloats your views and makes them difficult to reason about. Instead, let me show you a useful technique that involves applying polymorphism to dynamically load the proper view partial.
Published on Feb 16th, 2017.
Understand.io is used by hundreds of Laravel developers to find and fix errors.
Sign up for a free 14-day trial now.