src/Laravel/Middleware.php
public function handle($request, Closure $next)
    {
        $response = $next($request);

        // Apply logic differently based on the nature of $response.
        if ($response instanceof Renderable) {
            $response = obfuscateEmail($response->render());
        } elseif ($response instanceof Response) {
            $content = obfuscateEmail($response->getContent());
            $response->setContent($content);
        }

        return $response;
    }
public function handle($request, Closure $next)
    {
        $response = $next($request);

        // Apply logic differently based on the nature of $response.
        if ($response instanceof Renderable) {
            $response = obfuscateEmail($response->render());
        } elseif ($response instanceof Response) {
            $content = obfuscateEmail($response->getContent());
            $response->setContent($content);
        }

        return $response;
    }
Handle an incoming request.

@param  \Illuminate\Http\Request $request
@param  \Closure                 $next
@return mixed