larsjanssen6 / underconstruction
Requires
- php: ^7.4|^8.0
- illuminate/support: ^6.18|^7.0|^8.0|^9.0
Requires (Dev)
- mockery/mockery: ^1.3
- orchestra/testbench: ~3.8.0|^4.0|^7.0
- phpunit/phpunit: ^9.0
- symfony/thanks: ^1.0
- dev-master
- 8.1
- 7.2
- 7.1
- 7.0
- 6.1
- 6.0
- 5.2
- 5.1
- 5.0
- 4.0
- 3.0
- 2.9.3
- 2.9.2
- 2.9.1
- 2.9
- 2.8
- 2.7
- 2.6
- 2.5
- 2.4
- 2.3
- 2.1
- 2.0
- 1.3
- 1.2
- 1.1
- 1
- dev-dependabot/npm_and_yarn/minimist-1.2.8
- dev-dependabot/npm_and_yarn/express-4.18.2
- dev-dependabot/npm_and_yarn/qs-6.5.3
- dev-dependabot/npm_and_yarn/decode-uri-component-0.2.2
- dev-dependabot/npm_and_yarn/loader-utils-1.4.2
- dev-dependabot/npm_and_yarn/async-2.6.4
- dev-analysis-x09vOM
This package is auto-updated.
Last update: 2024-08-29 13:06:32 UTC
README
此Laravel包可以使您的网站设置为“施工中”模式。只有拥有正确4位密码的用户才能访问您的网站。此包可以用于向特定客户展示网站。一切都能直接使用,并且完全可定制。
如果您欣赏我的工作,请给这个仓库加星或买我一杯咖啡 ^ 🤗。
安装
首先通过Composer(兼容Laravel 6、7、8、9和10)安装此包!
composer require larsjanssen6/underconstruction
必须将 \LarsJanssen\UnderConstruction\UnderConstruction::class
中间件注册在内核中
//app/Http/Kernel.php protected $routeMiddleware = [ // ... 'under-construction' => \LarsJanssen\UnderConstruction\UnderConstruction::class, ];
默认值
发布默认配置文件。
php artisan vendor:publish # Or... php artisan vendor:publish --provider="LarsJanssen\UnderConstruction\UnderConstructionServiceProvider"
此包完全可定制。这是已发布配置文件 under-construction.php
的内容
<?php return [ /* * Activate under construction mode. */ 'enabled' => env('UNDER_CONSTRUCTION_ENABLED', true), /* * Hash for the current pin code */ 'hash' => env('UNDER_CONSTRUCTION_HASH', null), /* * Under construction title. */ 'title' => 'Under Construction', /* * Custom Route Prefix * */ 'route-prefix' => env('UNDER_CONSTRUCTION_ROUTE_PREFIX','under'), /* * Custom Endpoint if you don't want to use 'construction' * e.g. if you change to 'checkpoint', the route prefix * above will be appended giving you 'under/checkpoint' * */ 'custom-endpoint' => env('UNDER_CONSTRUCTION_CUSTOM_ENDPOINT','construction'), /* * Back button translation. */ 'back-button' => 'back', /* * Show button translation. */ 'show-button' => 'show', /* * Hide button translation. */ 'hide-button' => 'hide', /* * Show loader. */ 'show-loader' => true, /* * Redirect url after a successful login. */ 'redirect-url' => '/', /* * Enable throttle (max login attempts). */ 'throttle' => true, /* |-------------------------------------------------------------------------- | Throttle settings (only when throttle is true) |-------------------------------------------------------------------------- | */ /* * Set the amount of digits (max 6). */ 'total_digits' => 4, /* * Set the maximum number of attempts to allow. */ 'max_attempts' => 3, /* * Show attempts left. */ 'show_attempts_left' => true, /* * Attempts left message. */ 'attempts_message' => 'Attempts left: %i', /* * Too many attempts message. */ 'seconds_message' => 'Too many attempts please try again in %i seconds.', /* * Set the number of minutes to disable login. */ 'decay_minutes' => 5, /* * Prevent the site from being indexed by Robots when locked */ 'lock_robots' => true, ];
用法
您需要设置一个4位密码(您可以在配置文件中将此密码更改为最多6位)。您可以通过运行此自定义Artisan命令来完成此操作(在这个例子中,密码是 1234
,您显然可以设置另一个密码)。它将生成一个哈希值,该值将被存储在您的 .env
文件中。
php artisan code:set 1234
您可以通过在路由上使用 under-construction
中间件来设置路由为“施工中”模式。
Route::group(['middleware' => 'under-construction'], function () { Route::get('/live-site', function() { echo 'content!'; }); });
变更日志
有关最近更改的更多信息,请参阅 CHANGELOG。
测试
composer test
贡献
我很乐意听取您改进我的编码风格和约定的想法。请随意贡献。
安全
如果您发现任何与安全相关的问题,请通过电子邮件发送给 larsjanssen64@gmail.com。您也可以创建一个问题。
致谢
关于我
我是来自荷兰的Lars Janssen,喜欢从事Web项目。您可以在 Twitter 上关注我。
许可证
MIT许可证(MIT)。请参阅 许可证文件 获取更多信息。
❤️ 开源软件 - 给 ⭐️
我们已将出色的 symfony/thanks
composer包作为开发依赖项包含在内。通过为使用的包加星标来让您的操作系统包维护者知道您感谢他们。安装此包后,只需运行composer thanks即可。(不必担心,因为它是一个开发依赖项,所以它不会安装在您的实时环境中。)