PHP Class Flugg\Responder\Transformer

Author: Alexander Tømmerås ([email protected])
Inheritance: extends League\Fractal\TransformerAbstract
Exibir arquivo Open project: flugger/laravel-responder Class Usage Examples

Protected Properties

Property Type Description
$relations array A list of all available relations.

Public Methods

Method Description
allRelationsAllowed ( ) : boolean Check if the transformer has whitelisted all relations.
getRelations ( ) : array Get relations set on the transformer.
setRelations ( array | string $relations ) : self Set relations on the transformer.

Protected Methods

Method Description
callIncludeMethod ( League\Fractal\Scope $scope, string $includeName, mixed $data ) : League\Fractal\Resource\ResourceInterface | boolean Call method for retrieving a relation. This method overrides Fractal's own [callIncludeMethod] method to load relations directly from your models.
includePivot ( Illuminate\Database\Eloquent\Relations\Pivot $pivot ) : League\Fractal\Resource\ResourceInterface | boolean Include pivot table data to the response.

Method Details

allRelationsAllowed() public method

Check if the transformer has whitelisted all relations.
public allRelationsAllowed ( ) : boolean
return boolean

callIncludeMethod() protected method

Call method for retrieving a relation. This method overrides Fractal's own [callIncludeMethod] method to load relations directly from your models.
protected callIncludeMethod ( League\Fractal\Scope $scope, string $includeName, mixed $data ) : League\Fractal\Resource\ResourceInterface | boolean
$scope League\Fractal\Scope
$includeName string
$data mixed
return League\Fractal\Resource\ResourceInterface | boolean

getRelations() public method

Get relations set on the transformer.
public getRelations ( ) : array
return array

includePivot() protected method

Include pivot table data to the response.
protected includePivot ( Illuminate\Database\Eloquent\Relations\Pivot $pivot ) : League\Fractal\Resource\ResourceInterface | boolean
$pivot Illuminate\Database\Eloquent\Relations\Pivot
return League\Fractal\Resource\ResourceInterface | boolean

setRelations() public method

Set relations on the transformer.
public setRelations ( array | string $relations ) : self
$relations array | string
return self

Property Details

$relations protected_oe property

A list of all available relations.
protected array $relations
return array