<?php

namespace App\Api\Middleware;

use Auth;
use Closure;
use Response;

class Authenticate
{

    // Authorization
    public function handle($request, Closure $next)
    {
        if (Auth::guard('api')->guest()) {
            return Response::json([
                'status'      => 'Unauthenticated',
                'status_code' => 401,
                'message'     => '没有权限访问',
            ]);
        }

        return $next($request);
    }
}
