src/Http/Middleware/Authorize.php
public function handle($request, Closure $next, $authorizer)
    {
        $authorizer = $this->container->getAuthorizerByName($authorizer);
        $record = $this->route->getResource();

        if ($field = $this->route->getRelationshipName()) {
            $this->authorizeRelationship(
                $authorizer,
                $request,
                $record,
                $field
            );
        } else if ($record) {
            $this->authorizeResource($authorizer, $request, $record);
        } else {
            $this->authorize($authorizer, $request, $this->route->getType());
        }

        return $next($request);
    }
public function handle($request, Closure $next, $authorizer)
    {
        $authorizer = $this->container->getAuthorizerByName($authorizer);
        $record = $this->route->getResource();

        if ($field = $this->route->getRelationshipName()) {
            $this->authorizeRelationship(
                $authorizer,
                $request,
                $record,
                $field
            );
        } else if ($record) {
            $this->authorizeResource($authorizer, $request, $record);
        } else {
            $this->authorize($authorizer, $request, $this->route->getType());
        }

        return $next($request);
    }
Handle the request.

@param Request $request
@param Closure $next
@param string $authorizer
@return mixed
@throws AuthorizationException
@throws AuthenticationException