marshmallow/maintenance

A Laravel Nova tool to set your website in maintenance mode

1.1.0 2023-08-21 10:22 UTC

This package is auto-updated.

Last update: 2024-11-21 13:08:16 UTC


README

This package allows you to manage the Maintenance Mode for your application in Nova

Installation

You can install the package in to a Laravel app that uses Nova via composer:

composer require marshmallow/maintenance

To publish the config and view to give you more control. Run the following commands. Please note; these are both optional.

php artisan vendor:publish --tag="mm-maintenance-config"
php artisan vendor:publish --tag="mm-maintenance-views"

Two files have been added to your project:

Maintenance page: resources/views/vendor/marshmallow/maintenance

Config file: config/maintenance.php

Next up, you must register the tool with Nova. This is typically done in the tools method of the NovaServiceProvider.

// in app/Providers/NovaServiceProvider.php
use Marshmallow\Maintenance\Maintenance;

public function tools()
{
    return [
        // ...
        new Maintenance,
    ];
}

You can also add the maintenance tool to your Nova menu manually.

MenuSection::make(__('Maintenance'))
    ->icon('status-offline')
    ->path('/maintenance'),

Usage

Click on the "Maintenance Mode" menu item in your Nova app to see the tool provided by this package.

Maintenance Mode config Screenshot Maintenance Mode enabled Screenshot

Custom view

When you have build you own maintenance mode page, you can view this by updating the config file and update the value of the render key. For example:

// in config/maintenance.php
return [
    // ...
    'render' => 'maintenance.index',
];

Your file structure will look like this: resources/views/maintenance/index.blade.php

Or you can change the default view that comes with the package after installation. resources/views/vendor/marshmallow/maintenance/index.blade.php

Credits

License

The MIT License (MIT). Please see License File for more information.