<?php

namespace App\Http\Middleware;

use Closure;
use Illuminate\Support\Facades\Cache;

class ApiAuth
{
    /**
     * Handle an incoming request.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \Closure  $next
     * @return mixed
     */
    public function handle($request, Closure $next)
    {
        if ($request->input('api_token')&&Cache::has('tokenStr_'.$request->input('api_token'))){

            return $next($request);
        }
        return ['error'=>"请检查您的登录"];
    }
}
