Assignment 4

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

In this assignment, you will build several album pages exclusively using Eloquent. This means you cannot use the query builder (the DB class).

Requirements

The album list page

  1. There is an h1 with the text "Albums".
  2. Render a table containing all albums sorted alphabetically (A-Z) and the artist.
  3. Eager load the artists.
  4. The album title should be a link to the album details page.
  5. There should be an Edit link to edit the album.

The create album page

  1. There is an h1 with the text "New album".
  2. There is an input for the album title.
  3. There is a select menu for the artist which is database driven and sorted alphabetically (A-Z).
  4. Title and artist are required.
  5. The title should have a maximum of 20 characters.
  6. The selected artist must be a valid value in the database (use the exists validation rule).
  7. When creating an album, the flash message should say "Successfully created ALBUM TITLE HERE by ARTIST HERE".
  8. If the form is invalid, display the errors underneath each form field and the invalid data should appear in the form.

The edit album page

  1. There is an h1 with the text "Edit album: ALBUM TITLE HERE".
  2. There is an input for the album title and it is populated with the album title.
  3. There is a select menu for the artist which is database driven and sorted alphabetically (A-Z). The album's artist should be preselected.
  4. Title and artist are required.
  5. The title should have a maximum of 20 characters.
  6. The selected artist must be a valid value in the database (use the exists validation rule).
  7. When updating an album, the flash message should say "Successfully updated ALBUM TITLE HERE by ARTIST HERE"
  8. If the form is invalid, display the errors underneath each form field and the invalid data should appear in the form. Hint, use the second argument to Laravel's old() function so that the invalid data takes precendence over the album data being edited.

The album details page

  1. Display all tracks for the album in a table. Include the track name, genre, and price.
  2. In an h1 tag, display the album title.
  3. In a p tag underneath the h1, display the album's artist.

Extra credit (5 points)

  1. Eager load the genre for the tracks on the album details page

Code Requirements

  1. Install the Laravel Debugbar to monitor the SQL queries being run.
  2. Use Laravel's Blade templating. All pages should use a single layout that you define.
  3. All routes should map to a controller
  4. All routes should have a name and all URLs should use the route() helper function

Submission

Create a video with audio using Zoom where you demo your assignment and explain where you fulfilled or did not fulfill each requirement. Put a link to this recording in the README.md file at the root of your project.

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

If you're having problems uploading to GitHub, please zip up your project excluding the vendor folder and email it to the instructor and TA. Please include the Zoom recording URL in the email.