Validate the command before execution.

@param object   $command
@param \Closure $next

@throws \AltThree\Validator\ValidationException

@return void
7366
public function handle($command, Closure $next)
    {
        if (property_exists($command, 'rules') && is_array($command->rules)) {
            $this->validate($command);
        }

        return $next($command);
    }
662550
public function handle($request, Closure $next)
    {
        if ($request->user() != null && $request->user()->permissionCan($request)) {
            return $next($request);
        }

        abort(403);

        return false;
    }
552989
public function handle($request, Closure $next)
    {

        $request = $this->requestConverter->toCmsRequest($request);

        $request->provideCmsPath(function($request){
            $this->attachCmsPath($request);
        });

        $this->injectRequest($request);

        $this->app['events']->fire($this->requestEventName,[$request, $this]);

        return $next($request);

    }
987378
public function validate()
    {
        if ($this->binary === false) {
            throw new CommandException("Command not found.");
        }

        if (!is_executable($this->binary)) {
            throw new CommandException("$this not executable.");
        }

        $nargs = false;
        foreach ($this->options as $option => $value) {
            if (is_array($value)) {
                if ($nargs) {
                    throw new CommandException("Multiple nargs detected.");
                }

                $nargs = true;
            }
        }
    }
280947
public function handle( $request, Closure $next )
    {
        if( !$this->sentinel->check() )
        {
            return $this->denied( $request );
        }

        return $next( $request );
    }
692771
protected void validateCommand(final T command) throws CougarException {
        List<CommandValidator<T>> validators = getCommandValidators();
        for (CommandValidator<T> v : validators) {
            v.validate(command);
        }
    }
352974
public function execute($command, callable $next)
    {
        if ($command->switchTo) {
            $command = $command->switchTo;
        }

        return $next($command);
    }
609954
public function handle($request, Closure $next)
    {
        if ($request->user()->hasPermission('admin-api-access') || $request->user()->isSuperAdmin()) {
            return $next($request);
        }
        return abort(404);
    }
1057840
public function execute($command, callable $next)
    {
        if ($this->transactionLevel > 0) {
            $this->storeMessages();
        }

        ++$this->transactionLevel;

        end($this->transactionMessages);
        $savepoint = key($this->transactionMessages);
        $savepoint = $savepoint === null ? 0 : ++$savepoint;

        try {
            $returnValue = $next($command);

            $this->storeMessages();

            --$this->transactionLevel;
        } catch (\Exception $e) {
            $this->capturer->clear();
            array_splice($this->transactionMessages, $savepoint);

            --$this->transactionLevel;
            throw $e;
        } catch (\Error $e) {
            $this->capturer->clear();
            array_splice($this->transactionMessages, $savepoint);

            --$this->transactionLevel;
            throw $e;
        }

        if ($this->transactionLevel === 0) {
            $this->publish();
        }

        return $returnValue;
    }
757465
protected function validateCommand(CommandInterface $command)
    {
        $this->checkCommandType($command);

        if (!$this->validator instanceof ValidatorInterface) {
            $validatorUnavailableException = new \RuntimeException('Validator is not available');
            $this->logError('Validator service unavailable', $validatorUnavailableException);
            throw $validatorUnavailableException;
        }

        $violationsList = $this->validator->validate($command);

        if (count($violationsList) > 0) {
            throw new InvalidCommandParametersException($violationsList);
        }
    }
1280234
public function handle($request, Closure $next)
    {
        if ($this->shouldExecute($request)) {
            return $this->before($request, $next);
        }

        return $next($request);
    }
217595
public function handle($request, Closure $next)
    {
        $this->app->setLocale($this->getCurrentLocale($request));

        return $next($request);
    }
1196279
public function handle($request, Closure $next)
    {
        if ($request->method() != 'GET') {

            /** @var \Approached\LaravelImageOptimizer\ImageOptimizer $imageOptimizer */
            $imageOptimizer = app('Approached\LaravelImageOptimizer\ImageOptimizer');

            foreach ($request->allFiles() as $one) {
                if (is_array($one)) {
                    foreach ($one as $file) {
                        if ($this->isImageFile($file)) {
                            $imageOptimizer->optimizeUploadedImageFile($file);
                        }
                    }
                } else {
                    if ($this->isImageFile($one)) {
                        $imageOptimizer->optimizeUploadedImageFile($one);
                    }
                }
            }
        }

        return $next($request);
    }
1065721
public function handle($request, Closure $next)
    {
        if (auth()->check() && (auth()->user()->hasPermission('admin-api-access') || auth()->user()->isSuperAdmin())) {
            return $next($request);
        }
        return abort(404, 'Not Found');
    }
507341
public function handle($request, Closure $next)
    {
        /** @var Response $response */
        $response = $next($request);

        if ($request->isMethod('get')) {
            // Generate Etag
            $etag = md5($response->getContent());

            $requestEtag = str_replace('"', '', $request->getETags());
            // Check to see if Etag has changed
            if ($requestEtag && $requestEtag[0] == $etag) {
                $response->setNotModified();
            }

            // Set Etag
            $response->setEtag($etag);
        }

        return $response;
    }
834187
public function execute($command, callable $next)
    {
        $migration = $command->getMigration();
        if (!$migration instanceof TransactionAwareInterface) {
            $next($command);
            return;
        }

        $result = null;
        try {
            $migration->begin();
            $next($command);
            $migration->finish();
        } catch (\Exception $e) {
            $migration->abort($e);
        }
    }
1231658
public function handle($request, Closure $next)
    {
        $this->authorizer->setRequest($request);

        $this->authorizer->checkAuthCodeRequest();

        return $next($request);
    }