Assignment 6

For this assignment, scaffold a new Laravel application called "assignment-6".

Create a configurations Table

In your database, create a table named configurations with columns id (primary key), name (string), and value (boolean). Create this table with a migration. Be sure to add timestamp columns (created_at and updated_at) via the timestamps() method. These will be used when you update this table via Eloquent.

Insert a record into this table with name set to maintenance-mode and value set to false.

Maintenance Mode Middleware

You are going to create middleware that redirects users to a maintenance mode page (that you design yourself) at the URL path /maintenance if there is a record in the configurations table with a name of maintenance-mode and its value is true. If that record's value is false, users should be able to access the URL they requested. Create a test page at /test with anything you want on it with your middleware applied to it to verify everything works as expected.

If a user makes a request to /maintenance and the maintenance-mode setting is set false, the user should be redirected to /.

Name the middleware class MaintenanceMode.

A Settings Page

Create a secret page at /secret where I can toggle toggle the value column of the record in the configurations table with a name of maintenance-mode using a checkbox. This page should not have the MaintenanceMode middleware applied to it.

Other Requirements

  • Use Eloquent for all database queries

Deploy to Heroku / Zoom Recording

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

Alternatively, create a Zoom recording where you walk us through all of the requirements of the assignment. Put this link at the top of your project's README.md.

GitHub Classroom Submission

https://classroom.github.com/a/g-8uWWEZ

Please read the section on Git, GitHub, and GitHub Classroom on the class welcome page if you need to refresh yourself.