Assignment 3

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

The Tracks Page

Create a Tracks page located at /tracks that shows a table of all tracks sorted by the track name using the orderBy method. Display the following fields:

  1. track name
  2. album title
  3. artist name
  4. media type name
  5. genre name
  6. unit price
  7. minutes and seconds (derived from milliseconds) (tip: see @php Blade directive)

Creating Tracks

Add a link at the top of the page with the text "New track". Clicking this link should take you to /tracks/new. This page should display a form for creating a track. The form should contain:

  1. a text input for name
  2. a select menu populated with all available albums sorted alphabetically
  3. a select menu populated with all available media types sorted alphabetically
  4. a select menu populated with all available genres sorted alphabetically
  5. an input for the unit price
  6. a number input for milliseconds

When the user submits the form, the following should happen:

  1. Server-side validation via Laravel's validation rules. All fields are required. The album, media type, and genere selected must exist in the database. Unit price must be a number greater than 0.
  2. If the form is valid, the track is inserted into the database and the user is redirected back to the Tracks page with a success alert containing the text "The track "TRACK NAME" was successfully created", where TRACK NAME is replaced with the name of the newly created track.
  3. If the form is invalid, display error messages underneath each of the corresponding form controls. The form should also contain the user's invalid form data.

Code Requirements

  1. Use Laravel's Blade templating. All pages should use a single layout that you define.
  2. All database queries should use Laravel's Query Builder
  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/DZVsXohj

Email submissions will not be accepted.