JsonapiFormatter
class JsonapiFormatter extends Formatter
Properties
string | $content_type | The Content-Type this Formatter returns. | from Formatter |
protected ModelMapping | $mapping | Holds the mapping used to determine the appropriate Transformer for each Model. | from Formatter |
protected Controller | $controller | Holds the instanced of the calling controller. | from Formatter |
Methods
string
format(
mixed $data)
Generate a HTTP response body from an Eloquent Collection or Model.
Array
formatResource(
Model $model)
Format a single record.
string
getModelType(
Model $model)
master(Functional programming)
Details
in Formatter at line line 42
__construct(
ModelMapping $mapping,
Controller $controller)
Create a new instance.
at line line 16
string
format(
mixed $data)
Generate a HTTP response body from an Eloquent Collection or Model.
at line line 44
protected
Array
formatResource(
Model $model)
Format a single record.
in Formatter at line line 86
protected
Array
formatCollection(
Collection $collection)
Format an entire collection.
in Formatter at line line 100
protected
String
serialize(
Array $data)
Turn the transformed data into a JSON string.
in Formatter at line line 111
protected
Array
transform(
Model $model)
Apply the transformer to an Eloquent Model.
at line line 84
protected
string
getModelType(
Model $model)
master(Functional programming)