首页 > 解决方案 > 将用户登录限制在特定时间段

问题描述

我正在制作一个办公应用程序,我想限制用户仅在办公时间登录。但管理员随时登录

标签: phplaraveltime-limiting

解决方案


您可以为此制作自定义中间件。

例如,

namespace App\Http\Middleware;

use Closure;

class CheckTime
{
    public function handle($request, Closure $next)
    {
        if (!isAllowedTime()) {
            // reject user access
        }

        return $next($request);
    }
}

查看官方文档了解更多信息


推荐阅读