This website collects cookies to deliver better user experience
Week 5 of 100DaysOfCode Laravel Challenge
Week 5 of 100DaysOfCode Laravel Challenge
This week I finished the "Working with Databases" section at Laracasts. A recap of the week is presented below.
In the development phase of our app, we often run into the issue of needing to manually repopulate our database. This might be a good time to take a few moments to review database seeding. As you'll see, a bit of work upfront will save you so much time in the long run.
Database seeding is great but we had a lot of repetitive code to generate multiple records. Let's integrate model factories in order to seamlessly generate any number of database records.
In the previous episodes, we associated a blog post with an author. The next obvious step is to create a new route that renders all blog posts written by a particular author.
In this episode, you'll learn how to specify which relationships should be eager loaded by default on a model. We'll also touch on the pros and cons of such an approach.