<?php

namespace App\Http\Middleware;

use Closure;
use Illuminate\Http\Request;
use Symfony\Component\HttpFoundation\Response;
use Illuminate\Foundation\Http\Middleware\TransformsRequest;

class BoolTransformerMiddleware extends TransformsRequest
{
    protected function transform($key, $value)
    {
        if ($value === 'true' || $value === 'TRUE')
            return true;

        if ($value === 'false' || $value === 'FALSE')
            return false;

        return $value;
    }
}
