API
All the deep details of this library goes here.
Last updated
All the deep details of this library goes here.
Last updated
Please, note the difference between Collection and Builder coming from an Eloquent model, because that conditions the accesibility of these and other methods.
Extending the framework Illuminate\Database\Eloquent\Builder
.
Source: OpenSoutheners\LaravelApiable\Builder
Transforms collection of query results of valid JsonApiable
resources to a paginated JSON:API collection (JsonApiCollection
).
Parameters:
Name | Default |
---|---|
Example:
Extending the framework Illuminate\Support\Collection
.
Source: OpenSoutheners\LaravelApiable\Collection
Transforms collection of valid JsonApiable
resources to a JSON:API collection (JsonApiCollection
).
Note: This method doesn't paginate, for pagination take a look to the Builder::jsonApiPaginate.
Parameters:
None...
Example:
Model contract.
If the model below implements OpenSoutheners\LaravelApiable\Contracts\JsonApiable
and uses the trait OpenSoutheners\LaravelApiable\Concerns\HasJsonApi
, you could do the following to transform the model to JSON:API valid response:
These methods are available as global helpers functions (see examples).
Method used to get user config parameters for this specific package.
Example:
Transform passed value (can be instance of different types: Builder, Model, Collection, etc...).
Example:
Guess resource type from model class or instance.
Example:
Get resource type from model class or instance (if one specified, otherwise guess it using resourceTypeForModel
method).
Example:
Render errors in a JSON:API way. Check documentation on how to integrate this in your project.
Example:
Render content as a JSON:API serialised response. Check documentation on how to customise these reponses.
Example:
pageSize
null
columns
['*']
page
null