It's a bit overdue, but I need to add chapter headings to each series here at Laracasts. Come along as I use TDD to drive out this small change to the codebase. We might say a video belongs to a series, but also to a chapter within that series. Together, let's figure out how.
Have you ever had a controller action that, over time, grows and grows as you declare and fetch all necessary data for each new section of the page? Very quickly, things can become messy. Lately, I've been thinking about an alternative, widget-based approach for structuring portions of my views. Come along as I build this useful new
Widget class from scratch.
View the source code for this episode on GitHub.
In the previous episode, we tinkered around with the idea of widgets for our views. Let's now, mostly for learning purposes, extract this code into a reusable Composer package that anyone can pull in. When I need to create a new project, I always pull in Laravel Packager to expedite the setup process.
If you can't prove - through automated tests - that your package works correctly, how do you expect users to trust you? In this episode, we'll write a series of tests to confirm that our widget functionality works as expected. Once complete, we'll deploy the code to GitHub. At that point, the only remaining step is to submit to Packagist.org.
*Series still in development. Check back often for updates.