Assignment 2

This assignment will use Laravel and the chinook Postgres database that you hosted with Heroku in Week 2.

Start this assignment from the same installation that you did before Week 3.

Playlist Pages

Create a page at /playlists that displays all playlists from the playlists table.

Each playlist should be an anchor that links to /playlists/{id}, where {id} is replaced with the ID of each playlist.

When a user clicks on a playlist link, they should be taken to a page that displays all tracks for that playlist. Display the following information for each track in an HTML table:

  • Track name
  • Album title
  • Artist name
  • Genre name

Display the name of the playlist at the top of the page.

Display a link with the text "Back to Playlists" on a playlist page, similar to the "Back to Invoices" link.

Display the total number of tracks in a playlist on a playlist page in the format "Total tracks: N". You can use the count() function in PHP for this. You can also call ->count() on any database collection.

Page Layout

  • Add a link in the navigation for the playlists page
  • All pages should contain the full HTML skeleton
  • The playlists page should have a document title (the title tag) and page title of "Playlists"
  • A playlist page should have a document title and page title in the format of "Playlists: NAME" where NAME is replaced with the name of the playlist

Other Requirements

  • Use Laravel's Blade templating. All pages should use a single layout that you define.
  • All database queries should use Laravel's Query Builder
  • All routes should map to a controller
  • All URLs should use the route() helper function

Tips

  • You can create a controller using the artisan command php artisan make:controller PlaylistController

Deploy to Heroku

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

Submission

Send an email to Brighton and me with the URL to your GitHub repository with the subject: "ITP 405 - Assignment 2".