<?php

namespace App\Middleware;

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

class BeforeMiddleware 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 global middleware (before)...

        // This will run in sequence with other middleware located in the
        // $global array in `app/middleware/Middleware.php`. So if last in
        // group, it will run last, but still before the core of the application.

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

}