<?php

namespace App\Middleware;

use Snaju\Inception\Http\Middleware\MiddlewareInterface;
use Snaju\Inception\Http\Request\WebRequest;

class BeforeRouteMiddleware implements MiddlewareInterface
{

    public function process(WebRequest $request, \Closure $next)
    {
        // YOUR CODE GOES HERE. DO DB QUERY, CHANGE REQUESTS, ETC.
        // TODO: Do some process here for route middleware (before)...

        // This will run in sequence with other middleware located in the
        // array in the controller method. So if last in group, it will run last,
        // after global middleware, but before the core of the application.

        // Call the next middleware and pass the request object
        return $next($request);
    }

}