Assignment 4

For this assignment, scaffold a new Laravel application called "assignment-4".

Rebuild all of the albums pages

Rebuild all of the albums pages that we built together in class in Week 4 and at then end of Week 5 (editing an album) exclusively using Eloquent. That means no use of the query builder (the DB class). On the albums list page (the URL is /albums), be sure to eager load the artists to improve performance. Install the Laravel Debugbar to monitor the SQL queries that are being executed to load the page.

Feel free to skip sorting by artist name. This is a bit more complicated because it involves ordering by a relationship. If you are interested in learning how to do this, check out this example.

If you'd like extra practice working with Eloquent, give the following challenges a try.

Extra Eloquent Practice (optional)

  • Recreate Assignment 2 with Eloquent. You should have a many-to-many relationship between the Playlist model and the Track model.
  • Recreate Assignment 3 with Eloquent.
  • Eloquent problems
    1. Find all tracks with the genre "Metal".
    2. Find all customers who work for "Apple Inc.".
    3. Find invoice 5 and update its BillingAddress to "123 Sesame Street".
    4. What is the total of all invoices in 2012?
    5. What is the average track length?

For the last 2, check out the documentation on Retrieving Aggregates.

Deploy to Heroku / Zoom Recording

Deploy your Laravel app to Heroku and verify that it works. At the top of your project's README.md, add your Heroku link.

Alternatively, create a Zoom recording where you walk us through all of the requirements of the assignment. Put this link at the top of your project's README.md.

GitHub Classroom Submission

https://classroom.github.com/a/qtJbUYxQ

Please read the section on Git, GitHub, and GitHub Classroom on the class welcome page if you need to refresh yourself.