tanedaa/laravel-dynamic-maintenance 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

tanedaa/laravel-dynamic-maintenance

最新稳定版本:1.2.0

Composer 安装命令:

composer require tanedaa/laravel-dynamic-maintenance

包简介

A Laravel package to enable maintenance mode for specific named routes

README 文档

README

A simple package to allow enabling maintenance mode for specific named routes.

Installation

Require this package with composer. Works for Laravel 10 and above. Not tested for other versions.

composer require tanedaa/laravel-dynamic-maintenance

Publish the commands, middleware and custom maintenance view

php artisan vendor:publish --tag=laravel-dynamic-maintenance

Register the maintenance middleware to the routes you want to enable dynamic maintenance on.

Route::middleware('maintenance')->group(function () {
    Route::get('/', function () {
        return view('welcome');
    });
});

Usage

Enable or disable maintenance mode for specific named routes by providing a comma-separated list of routes to the following commands. Wildcard routes are supported as well. Optionally, you can provide a secret key to bypass maintenance mode.

php artisan down:routes {routes} {--secret}
php artisan up:routes {routes} | all

To bypass maintenance mode, add a query parameter secret with the secret key you provided when enabling maintenance mode.

http://example.com/home?secret=mySecretKey

Examples

php artisan down:routes welcome, home.contact
php artisan down:routes home.about --secret=mySecretKey
php artisan down.routes api/*
php artisan up:routes home.index, home.contact
php artisan up.routes api/*
php artisan up.routes all

Configuration

Optionally, you can change the maintenance mode Title, Message and HTTP Code in the custom view for the dynamic maintenance routes by adding the following variables to your .env file:

MAINTENANCE_TITLE = 'Service Unavailable'
MAINTENANCE_MESSAGE = 'Service Unavailable'
MAINTENANCE_CODE = 503

统计信息

  • 总下载量: 8
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 0
  • 开发语言: Blade

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-08-10