This assignment will build off the authentication demo we do in class, so you will want to use that code base.
In your database, create a table named
configurations with columns for
id (primary key),
name (string), and
value (string). Create this table with a migration.
Insert a records into this table
name set to “maintenance” and
value set to “off”.
/ route so that it redirects to some existing route.
You are going to create middleware that redirects users to a maintenance mode page at the path
/maintenance if there is a record in the
configurations table with a
name of “maintenance” and its
value is “on”. If that record’s
value is “off”, users should not be redirected to that page. Name the middleware
MaintenanceMode. This middleware should only apply to public routes (the ones without the
protected middleware), but exclude the following so that certain users can login even if the site is in maintenance mode.
/settings page that is protected by authentication. This page will have a form with one checkbox that will toggle the
configurations record with a