PoweredLocal/vrata

View on GitHub
app/Http/Middleware/HelperMiddleware.php

Summary

Maintainability
A
0 mins
Test Coverage
<?php

namespace App\Http\Middleware;

use App\Http\Request;
use App\Routing\RouteRegistry;
use Closure;

class HelperMiddleware
{
    /**
     * Handle an incoming request.
     *
     * @param Request $request
     * @param  \Closure  $next
     * @param string $id
     * @return mixed
     */
    public function handle(Request $request, Closure $next, $id)
    {
        $request->attachRoute(
            app()->make(RouteRegistry::class)->getRoute($id)
        );

        return $next($request);
    }
}