<?php

namespace App\Http\Middleware;

use Closure;
use Illuminate\Http\Request;

class DisableAssetCacheInDebug
{
    public function handle(Request $request, Closure $next)
    {
        $response = $next($request);

        if (config('app.debug')) {
            $response->headers->set('Cache-Control', 'no-store, no-cache, must-revalidate');
            $response->headers->set('Expires', '0');
        }

        return $response;
    }
}
