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:
- track name
- album title
- artist name
- media type name
- genre name
- unit price
- 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:
- a text input for name
- a select menu populated with all available albums sorted alphabetically
- a select menu populated with all available media types sorted alphabetically
- a select menu populated with all available genres sorted alphabetically
- an input for the unit price
- a number input for milliseconds
When the user submits the form, the following should happen:
- 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.
- 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.
- 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
- 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 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.