Simple plugin to toggle maintenance mode from Filament.

Overview

Filament Maintenance Plugin

GitHub Tests Action Status Latest Version on Packagist

This plugin allows you to easily toggle maintenance mode from your Filament Admin Panel. You can also set a secret token to bypass the maintenance mode.

Installation

You can install the package via composer:

composer require brickx/laravel-filament-maintenance

You can publish the config file with:

php artisan vendor:publish --tag="filament-maintenance-config"

This is the contents of the published config file:

return [
    'secret' => null,
    'refresh' => false,
    'permissions' => false,
    'role' => false,
    'tiny_toggle' => false,
];

You can publish the translations with:

php artisan vendor:publish --tag="filament-maintenance-translations"

Optionally, you can publish the views using:

php artisan vendor:publish --tag="filament-maintenance-views"

Setup

An optional step (but highly recommended) is to modify the App\Http\Middleware\PreventRequestsDuringMaintenance class to add the following code:

protected function bypassResponse(string $secret) : RedirectResponse
{
    return redirect('admin')->withCookie(
        MaintenanceModeBypassCookie::create($secret)
    );
}

This is because Laravel's default maintenance middleware will redirect to the / route, which feels weird.

Usage

The plugin will add a toggle button to your Filament Admin Panel, right before the search bar.

Clicking it will trigger the php artisan down command if the website is live, and the php artisan up command otherwise.

Secret Token

You can set a secret token in the config file. If you do so, you will be able to bypass the maintenance mode by visiting the following URL: https://your-domain.test/{secret}.

If the secret key is set to null, a random one will be generated on the fly each time the maintenance mode is activated.

Refresh Interval

If you want to instruct browsers to refresh pages after a certain amount of time, you can set the refresh key in the config file.

When set to false, no Refresh HTTP header will be sent. You can specify an integer to define the number of seconds before reloading pages under maintenance mode.

Visibility

By default, any logged-in user will be able to toggle the maintenance mode.

If you want to restrict maintenance mode toggling to certain users, you can set the permissions key in the config file.

The plugin will use Laravel's default authorization system to check for permissions, via the can method on the User model. It will also work well with Spatie's Laravel Permission package.

Todo

  • Fix toggle button styling not properly updating when maintenance mode is disabled.
  • Improve the UX by directly adding the maintenance cookie from the Livewire component (instead of redirecting to the matching URL).

Changelog

Please see CHANGELOG for more information on what has changed recently.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

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

Comments
  • Problem With Instalation on Laravel 10

    Problem With Instalation on Laravel 10

    What happened?

    I can't Install this pakage

    How to reproduce the bug

    Your requirements could not be resolved to an installable set of packages.

    Problem 1 - brickx/laravel-filament-maintenance[dev-main, 1.0.0, ..., 1.0.1] require illuminate/contracts ^10.11 -> found illuminate/contracts[v10.11.0, ..., 10.x-dev] but these were not loaded, likely because it conflicts with another require. - Root composer.json requires brickx/laravel-filament-maintenance * -> satisfiable by brickx/laravel-filament-maintenance[dev-main, 1.0.0, 1.0.1, 9999999-dev].

    You can also try re-running composer require with an explicit version constraint, e.g. "composer require brickx/laravel-filament-maintenance:*" to figure out if any version is installable, or "composer require brickx/laravel-filament-maintenance:^2.1" if you know which you need.

    Installation failed, reverting ./composer.json and ./composer.lock to their original content.

    Package Version

    1.0.1

    PHP Version

    8.2.4

    Laravel Version

    10.7.1

    Which operating systems does with happen with?

    Windows

    Notes

    No response

    bug 
    opened by frizcool 8
  • Add visibility option

    Add visibility option

    This pull request adds the visibility option to the item, according to a pattern found in some packages like https://github.com/pxlrbt/filament-environment-indicator/blob/main/src/FilamentEnvironmentIndicator.php https://github.com/bezhanSalleh/filament-shield

    enhancement 
    opened by a21ns1g4ts 4
  • Bump aglipanci/laravel-pint-action from 2.2.0 to 2.3.0

    Bump aglipanci/laravel-pint-action from 2.2.0 to 2.3.0

    Bumps aglipanci/laravel-pint-action from 2.2.0 to 2.3.0.

    Release notes

    Sourced from aglipanci/laravel-pint-action's releases.

    v2.3.0

    Commits
    • 859b17c Merge pull request #8 from likeadeckofcards/main
    • 2d7710d Add extended note to useComposer flag
    • 9594200 Add new flag for using the local project pint version
    • 1fce957 Get pint version from local composer
    • 0ac6db6 Merge pull request #7 from Nathanjms/patch-1
    • 859061e Update README.md
    • See full diff in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    opened by dependabot[bot] 1
  • Bump dependabot/fetch-metadata from 1.5.0 to 1.5.1

    Bump dependabot/fetch-metadata from 1.5.0 to 1.5.1

    Bumps dependabot/fetch-metadata from 1.5.0 to 1.5.1.

    Release notes

    Sourced from dependabot/fetch-metadata's releases.

    v1.5.1

    What's Changed

    Bugfix:

    Dep bumps that are trivial so decided to keep this a patch release:

    Internal-facing infra changes:

    Full Changelog: https://github.com/dependabot/fetch-metadata/compare/v1...v1.5.1

    Commits
    • cd6e996 v1.5.1 (#384)
    • 64bd9b8 Fix library parser to trim trailing LF (#380)
    • 0908fa1 Merge pull request #382 from dependabot/dependabot/npm_and_yarn/types/node-20...
    • 2624edc Bump @​types/node from 20.2.1 to 20.2.3
    • d1defa4 Switch to using an app token instead of a PAT (#362)
    • cb17c9e Merge pull request #379 from dependabot/dependabot/npm_and_yarn/yargs-17.7.2
    • c6f9c16 Bump yargs from 17.7.1 to 17.7.2
    • 0f53327 Merge pull request #378 from dependabot/dependabot/npm_and_yarn/eslint-depend...
    • 398ed41 Bump the eslint-dependencies group with 2 updates
    • 801acab Merge pull request #375 from dependabot/dependabot/npm_and_yarn/eslint-depend...
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    opened by dependabot[bot] 1
  • Bump dependabot/fetch-metadata from 1.4.0 to 1.5.0

    Bump dependabot/fetch-metadata from 1.4.0 to 1.5.0

    Bumps dependabot/fetch-metadata from 1.4.0 to 1.5.0.

    Release notes

    Sourced from dependabot/fetch-metadata's releases.

    v1.5.0

    What's Changed

    New Features:

    Bumped Deps:

    Docs:

    Code cleanup:

    Full Changelog: https://github.com/dependabot/fetch-metadata/compare/v1...v1.5.0

    Commits
    • 28a846a v1.5.0 (#372)
    • a2a3a43 Add workflow for floating the v1 tag to the latest release (#361)
    • 6c5b8c2 Add workflow for creating release PR's (#360)
    • c40140b Stop using deprecated set-output (#370)
    • 042f8db Add a deeplink for tagging releases to the Readme (#369)
    • fd7c300 Simplify bin/bump-version (#368)
    • 9cc71e7 Merge pull request #366 from dependabot/dependabot/npm_and_yarn/nock-13.3.1
    • f29558c Bump nock from 13.3.0 to 13.3.1
    • ec762dd Merge pull request #364 from dependabot/dependabot/npm_and_yarn/types/node-20...
    • e79c5ea Bump @​types/node from 18.15.11 to 20.2.1
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    opened by dependabot[bot] 1
Releases(1.1.2)
  • 1.1.2(Jun 14, 2023)

    What's Changed

    • Added refresh option by @Keysaw in https://github.com/Keysaw/laravel-filament-maintenance/pull/6

    Full Changelog: https://github.com/Keysaw/laravel-filament-maintenance/compare/1.1.1...1.1.2

    Source code(tar.gz)
    Source code(zip)
  • 1.1.1(Jun 9, 2023)

  • 1.1.0(Jun 9, 2023)

    What's Changed

    • Bump dependabot/fetch-metadata from 1.5.0 to 1.5.1 by @dependabot in https://github.com/Keysaw/laravel-filament-maintenance/pull/2
    • Bump aglipanci/laravel-pint-action from 2.2.0 to 2.3.0 by @dependabot in https://github.com/Keysaw/laravel-filament-maintenance/pull/3
    • Add visibility option by @a21ns1g4ts in https://github.com/Keysaw/laravel-filament-maintenance/pull/5

    New Contributors

    • @a21ns1g4ts made their first contribution in https://github.com/Keysaw/laravel-filament-maintenance/pull/5

    Full Changelog: https://github.com/Keysaw/laravel-filament-maintenance/compare/1.0.1...1.1.0

    Source code(tar.gz)
    Source code(zip)
  • 1.0.1(May 27, 2023)

    Minor improvements & refactoring. Addition of basic tests using Pest.

    Full Changelog: https://github.com/Keysaw/laravel-filament-maintenance/compare/1.0.0...1.0.1

    Source code(tar.gz)
    Source code(zip)
Owner
Keysaw
Full-Stack Developer at BRICKX!
Keysaw
This Laravel 8 package makes it possible for you to set your website in "Under Construction" mode.

Laravel Under Construction This Laravel package makes it possible to set your website in "Under Construction" mode. Only users with the correct 4 digi

Lars Janssen 571 Dec 18, 2022
A media picker plugin for Filament Admin.

Filament Curator A media picker plugin for Filament Admin. ‼️ This package is still in development ‼️ This package does not work with Spatie Media Lib

Adam Weston 84 Jan 7, 2023
Plugin for Filament Admin that adds a dropdown menu to the header to quickly create new items.

Filament Quick Create Plugin for Filament Admin that adds a dropdown menu to the header to quickly create new items from any page. Installation Instal

Adam Weston 45 Dec 27, 2022
Filament Plugin to help implement Cloudflare turnstile into your forms.

Filament Turnstile Filament Turnstile, is a plugin to help you implement the Cloudflare turnstile. This plugin uses Laravel Turnstile Behind the scene

Coderflex 5 Jun 12, 2023
A simple profile management page for Filament. ✨

A simple profile page for Filament. This package provides a very simple Profile page that allows the current user to manage their name, email address

Ryan Chandler 65 Jan 5, 2023
Add a general-purpose tools page to your Filament project. 🛠

Add a general-purpose tools page to your Filament project. Installation You can install the package via Composer: composer require ryangjchandler/fila

Ryan Chandler 24 Dec 6, 2022
The Most Popular JavaScript Calendar as a Filament Widget 💛

The Most Popular JavaScript Calendar as a Filament Widget ?? Features Accepts all configurations from FullCalendar Event click and drop events Upcomin

Guilherme Saade 62 Dec 31, 2022
A single-field repeater for Filament. ⚡️

A single-field repeater for Filament. This is where your description should go. Limit it to a paragraph or two. Consider adding a small example. Insta

Ryan Chandler 3 Mar 5, 2022
A convenient helper for using the laravel-seo package with Filament Admin and Forms

Combine the power of Laravel SEO and Filament PHP. This package is a convenient helper for using the laravel-seo package with Filament Admin and Forms

Ralph J. Smit 39 Dec 21, 2022
Easily interact and control your feature flags from Filament

Easily interact and control your feature flags from Filament

Ryan Chandler 32 Nov 29, 2022
Admin user, role and permission management for Laravel Filament

Filament Access Control Opinionated setup for managing admin users, roles and permissions within Laravel Filament Features Separate database table for

Elisha Witte 69 Jan 4, 2023
Build structured navigation menus in Filament.

Build structured navigation menus in Filament. This plugin for Filament provides a Navigation resource that allows to build structural navigation menu

Ryan Chandler 61 Dec 30, 2022
Access laravel log through Filament admin panel

Access laravel log through Filament admin panel Features Syntax highlighting Quickly jump between start and end of the file Refresh log contents Clear

Guilherme Saade 20 Nov 22, 2022
A collection of reusable components for Filament.

A collection of reusable components for Filament. This package is a collection of handy components for you to use in all your Filament projects. It pr

Ralph J. Smit 35 Nov 16, 2022
Social login for Filament through Laravel Socialite

Social login for Filament through Laravel Socialite Add OAuth login through Laravel Socialite to Filament. Installation You can install the package vi

Dutch Coding Company 44 Dec 26, 2022
Provides the missing range field for the Filament forms.

The missing range field for the Filament forms. Installation You can install the package via composer: composer require yepsua/filament-range-field Pu

null 11 Sep 10, 2022
Configurable activity logger for filament.

Activity logger for filament Configurable activity logger for filament. Powered by spatie/laravel-activitylog Features You can choose what you want to

Ziyaan 58 Dec 30, 2022
Add a progress bar column to your Filament tables.

Add a progress bar column to your Filament tables. This package provides a ProgessColumn that can be used to display a progress bar in a Filament tabl

Ryan Chandler 22 Nov 12, 2022
Simply define the permission in the filament resource.

Simply define the permissions in the filament resource. Easily define permissions for Filament Resources & Relation Managers Installation You can inst

Ziyaan 8 Nov 16, 2022