php - 将用户登录限制在特定时间段
问题描述
我正在制作一个办公应用程序,我想限制用户仅在办公时间登录。但管理员随时登录
解决方案
您可以为此制作自定义中间件。
例如,
namespace App\Http\Middleware;
use Closure;
class CheckTime
{
public function handle($request, Closure $next)
{
if (!isAllowedTime()) {
// reject user access
}
return $next($request);
}
}
查看官方文档了解更多信息
推荐阅读
- python - 在熊猫数据框中提取字典字典并将它们连接起来时出现问题?
- c# - Mongo DB 数据库保护
- shell - 如何在 Unix 中的变量中捕获表的行数
- linux-kernel - bme680_i2c:未知符号 __devm_regmap_init_i2c(错误 -2)
- apache-spark - 填充和插入考拉数据框
- macos - 在范围内找不到 TestView
- react-native - Flatlist 下面的 React Native View 闪烁
- python - 三元搜索不会返回答案
- php - WooCommerce 订阅:结帐后更改续订日期
- javascript - 如何在 d3.js 中“取消堆叠”我的 JSON 数据?