class ApiController implements ExtenderInterface
Methods
Set the serializer that will serialize data for the endpoint.
Include the given relationship by default.
Don't include the given relationship by default.
Make the given relationship available for inclusion.
Don't allow the given relationship to be included.
Set the default number of results.
Set the maximum number of results.
Allow sorting results by the given field.
Disallow sorting results by the given field.
Set the default sort order for the results.
Eager loads relationships needed for serializer logic.
Allows loading a relationship with additional query modification.
Details
at
line 39
__construct(string $controllerClass)
at
line 52
ApiController
prepareDataQuery(callable|string $callback)
at
line 74
ApiController
prepareDataForSerialization(callable|string $callback)
at
line 95
ApiController
setSerializer(string $serializerClass, callable|string|null $callback = null)
Set the serializer that will serialize data for the endpoint.
at
line 116
ApiController
addInclude($name, callable|string|null $callback = null)
Include the given relationship by default.
at
line 137
ApiController
removeInclude($name, callable|string|null $callback = null)
Don't include the given relationship by default.
at
line 158
ApiController
addOptionalInclude($name, callable|string|null $callback = null)
Make the given relationship available for inclusion.
at
line 179
ApiController
removeOptionalInclude($name, callable|string|null $callback = null)
Don't allow the given relationship to be included.
at
line 200
ApiController
setLimit(int $limit, callable|string|null $callback = null)
Set the default number of results.
at
line 221
ApiController
setMaxLimit(int $max, callable|string|null $callback = null)
Set the maximum number of results.
at
line 242
ApiController
addSortField(string|array $field, callable|string|null $callback = null)
Allow sorting results by the given field.
at
line 263
ApiController
removeSortField(string|array $field, callable|string|null $callback = null)
Disallow sorting results by the given field.
at
line 284
ApiController
setSort(array $sort, callable|string|null $callback = null)
Set the default sort order for the results.
at
line 305
ApiController
load(string|string[] $relations)
Eager loads relationships needed for serializer logic.
First level relationships will be loaded regardless of whether they are included in the response. Sublevel relationships will only be loaded if the upper level was included or manually loaded.
at
line 325
ApiController
loadWhere(string $relation, callable $callback)
Allows loading a relationship with additional query modification.