<?php

namespace app\middleware;

use Closure;
use think\Request;

/**
 * 前台登录验证
 *
 * Class Login
 * @package app\middleware
 */
class Login
{
    public function handle(Request $request, Closure $next)
    {
        if (!session('frontend_auth')) {
            $url = $request->url(true);
            return redirect(url('login/index').'?url='.urlencode($url));
        }

        return $next($request);
    }
}