You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Set default appends (applied only when append is absent; ?append= disables defaults)
tap(callable $callback)
Add query modification callback
Execution Methods
Method
Description
get()
Execute and return Collection
first()
Execute and return first result
firstOrFail()
Execute and return first result or throw exception
paginate($perPage)
Execute with pagination
simplePaginate($perPage)
Execute with simple pagination
cursorPaginate($perPage)
Execute with cursor pagination
chunk($count, $callback)
Process results in chunks with post-processing
chunkById($count, $callback)
Process results in chunks by ID with post-processing
lazy($chunkSize)
Return LazyCollection with post-processing
cursor()
Return cursor LazyCollection with post-processing
toQuery()
Build and return query builder
getSubject()
Get underlying query builder
applyPostProcessingTo($results)
Apply full post-processing (fields + appends) to results
getPassthroughFilters()
Get passthrough filter values using the same validation/default/prepare pipeline as normal filter execution
ModelQueryWizard Methods
Factory Methods
Method
Description
for($model)
Create from a Model instance
Configuration Methods
Method
Description
schema($schema)
Set ResourceSchema for configuration
allowedIncludes(...$includes)
Set allowed includes
disallowedIncludes(...$names)
Remove includes
defaultIncludes(...$names)
Set default includes (effective only when include is absent and the names are also allowed by allowlist/schema)
allowedFields(...$fields)
Set allowed fields
disallowedFields(...$names)
Remove fields
defaultFields(...$fields)
Set default fields (effective only when fields is absent)
allowedAppends(...$appends)
Set allowed appends
disallowedAppends(...$names)
Remove appends
defaultAppends(...$appends)
Set default appends (effective only when append is absent and the names are also allowed by allowlist/schema)
All configuration methods must be called before process(). After processing, create a new ModelQueryWizard instance for any different configuration or request parameters.
Execution Methods
Method
Description
process()
Apply includes, fields, appends and return the model; repeated calls are only safe when configuration and parameters are unchanged
getModel()
Get the underlying model instance
Parameter Semantics
Defaults apply only when the corresponding top-level parameter is absent.
?include= means "include nothing" and does not merge defaultIncludes().
?append= means "append nothing" and does not merge defaultAppends().
?fields= means an explicit empty root fieldset.
?fields[relation]= means an explicit empty fieldset for that relation.
?sort= is invalid and throws InvalidSortQuery.
Active count / exists includes remain visible even when the root fieldset is empty.
Skip raw shape validation and validate only the prepared value shape
asBoolean()
Convert 'true'/'1'/'yes' to boolean
Built-in Filter Value Shapes
exact, partial, operator: scalar or flat list of scalars
scope: single value or flat list without nested arrays
null, trashed: scalar only
range, dateRange: array with boundary keys or a flat list with at least two values
Malformed built-in filter payloads raise InvalidFilterQuery::invalidFormat(...). disable_invalid_filter_query_exception does not suppress malformed payload format errors; it only affects unknown filter names.
Use allowStructuredInput() when a built-in filter should intentionally accept structured raw input that will be normalized inside prepareValueWith(). The prepared value is still validated against the built-in filter's contract before apply() runs.
Check relationship existence (adds boolean attribute)
callback($name, $callback, $alias)
Custom callback include
Count / exists include aliases are request-facing only. The serialized attribute key remains Laravel's default runtime key (for example posts_count or posts_exists), and those runtime attributes stay visible even when root sparse fieldsets are applied.