<?php

namespace App\Http\Middleware;

use Closure;
use Illuminate\Http\Request;

class EnsureApiEnabled
{
    public function handle(Request $request, Closure $next)
    {
        if (!config('api.enabled')) {
            return response()->json([
                'message' => 'API access is disabled on this server.',
            ], 503);
        }

        return $next($request);
    }
}
