src/Http/Middleware/ValidatesRequests.php
public function validate(
        InboundRequestInterface $inboundRequest,
        StoreInterface $store,
        ValidatorProviderInterface $resource,
        ValidatorProviderInterface $related = null
    ) {
        /** Check the JSON API query parameters */
        if (!$inboundRequest->getRelationshipName()) {
            $this->checkQueryParameters($inboundRequest, $resource);
        } elseif ($related) {
            $this->checkQueryParameters($inboundRequest, $related);
        }

        $identifier = $inboundRequest->getResourceIdentifier();
        $record = $identifier ? $store->findOrFail($identifier) : null;

        /** Check the JSON API document is acceptable */
        $this->checkDocumentIsAcceptable($inboundRequest, $resource, $record);
    }
public function validate(
        InboundRequestInterface $inboundRequest,
        StoreInterface $store,
        ValidatorProviderInterface $resource,
        ValidatorProviderInterface $related = null
    ) {
        /** Check the JSON API query parameters */
        if (!$inboundRequest->getRelationshipName()) {
            $this->checkQueryParameters($inboundRequest, $resource);
        } elseif ($related) {
            $this->checkQueryParameters($inboundRequest, $related);
        }

        $identifier = $inboundRequest->getResourceIdentifier();
        $record = $identifier ? $store->findOrFail($identifier) : null;

        /** Check the JSON API document is acceptable */
        $this->checkDocumentIsAcceptable($inboundRequest, $resource, $record);
    }
public function validate ( InboundRequestInterface $ inboundRequest , StoreInterface $ store , ValidatorProviderInterface $ resource , ValidatorProviderInterface $ related = null ) { /** Check the JSON API query parameters */ if ( ! $ inboundRequest -> getRelationshipName ( ) ) { $ this -> checkQueryParameters ( $ inboundRequest , $ resource ) ; } elseif ( $ related ) { $ this -> checkQueryParameters ( $ inboundRequest , $ related ) ; } $ identifier = $ inboundRequest -> getResourceIdentifier ( ) ; $ record = $ identifier ? $ store -> findOrFail ( $ identifier ) : null ; /** Check the JSON API document is acceptable */ $ this -> checkDocumentIsAcceptable ( $ inboundRequest , $ resource , $ record ) ; }
Validate the inbound request query parameters and JSON API document.

JSON API query parameters are checked using the primary resource's validators
if it is not a related resource request, or against the related resource's
validators if it is a relationship request. This is because the query parameters
for a relationship request actually relate to the related resource that will
be returned in the encoded response.

So for a request to `GET /posts/1`, the `posts` validators are provided as
`$resource` and the query parameters are checked using this set of validators.
For a request to `GET /posts/1/comments` the query parameters are checked
against the `comments` validators, which are provided as `$related`.

The JSON API document is always checked against the primary resource validators
(`$resource`) because the inbound document always relates to this primary
resource, even if modifying a relationship.

@param InboundRequestInterface $inboundRequest
@param StoreInterface $store
@param ValidatorProviderInterface $resource
validators for the primary resource.
@param ValidatorProviderInterface|null $related
validators for the related resource, if the request is for a relationship.
@return void
@throws JsonApiException
Validate the inbound request query parameters and JSON API document .