Software Engineer · Teacher · Author · Vegan

Laravel 2

This assignment will use Laravel and the chinook SQLite database.

All Laravel assignments, labs, and class demos will build on the same installation.

Create a navigation that is accessible on all pages via a Blade layout. In this navigation, create links for:

If your assignments are using a separate installation than what we did in class, create an empty page for the / URL. This page should use your layout template so that the navigation shows up on it.

Creating a Track

On the /tracks page, put a button with the label “Add Track” at the top of the screen. Clicking this button should take you to /tracks/new. This page should display a form for adding a track. The form should contain:

When the user hits the “Save” button, the following should happen:

  @foreach($tracks as $track)
    <option value="{{$track->TrackId}}" {{$track->TrackId == '2822' ? "selected" : ""}}>

This example is using a shorthand if/else statement called the ternary operator.

Editing a Genre Name

Next to each genre on the /genres page that you did in Assignment 1, display an “Edit” link. When this link clicked, it will take you to /genres/{id}/edit, where the user is presented with a form populated with the name of the genre that was clicked. Check out how to retrieve a single row from a table using first().

When the user hits the “Save” button, the following should happen: