<?php

namespace App\Http\Middleware;

use Closure;
use Illuminate\Support\Facades\URL;

class DecodingRequest
{
    /**
     * Handle an incoming request.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \Closure  $next
     * @return mixed
     */
    public function handle($request, Closure $next)
    {
        if ($request->method() == "GET"){
            foreach ($request->input() as $key => $value){
                if ($value != null)$request->offsetSet($key, urldecode($value));
            }
        }
        return $next($request);
    }
}
