PHP Class Sleimanx2\Plastic\Fillers\EloquentFiller

Inheritance: implements Sleimanx2\Plastic\Fillers\FillerInterface
Show file Open project: sleimanx2/plastic

Public Methods

Method Description
fill ( Model $model, PlasticResult $result ) : mixed | void Fill the results hists into Model.
fillModel ( Model $model, array $hit = [] ) : static New From Hit Builder.
loadPivotAttribute ( Model $model, Illuminate\Database\Eloquent\Relations\Relation $parentRelation = null ) Get the pivot attribute from a model.
newFromBuilderRecursive ( Model $model, array $attributes = [], Illuminate\Database\Eloquent\Relations\Relation $parentRelation = null ) : mixed Fill a model with form an elastic hit.

Protected Methods

Method Description
hydrateRecursive ( Model $model, array $items, Illuminate\Database\Eloquent\Relations\Relation $parentRelation = null ) : Collection Create a collection of models from plain arrays recursive.
loadRelationsAttributesRecursive ( Model $model ) Get the relations attributes from a model.

Private Methods

Method Description
isMultiLevelArray ( array $array ) : boolean Check if an array is multi-level array like [[id], [id], [id]].

Method Details

fill() public method

Fill the results hists into Model.
public fill ( Model $model, PlasticResult $result ) : mixed | void
$model Illuminate\Database\Eloquent\Model
$result Sleimanx2\Plastic\PlasticResult
return mixed | void

fillModel() public method

Variation on newFromBuilder. Instead, takes
public fillModel ( Model $model, array $hit = [] ) : static
$model Illuminate\Database\Eloquent\Model
$hit array
return static

hydrateRecursive() protected method

Create a collection of models from plain arrays recursive.
protected hydrateRecursive ( Model $model, array $items, Illuminate\Database\Eloquent\Relations\Relation $parentRelation = null ) : Collection
$model Illuminate\Database\Eloquent\Model
$items array
$parentRelation Illuminate\Database\Eloquent\Relations\Relation
return Illuminate\Support\Collection

loadPivotAttribute() public method

Get the pivot attribute from a model.
public loadPivotAttribute ( Model $model, Illuminate\Database\Eloquent\Relations\Relation $parentRelation = null )
$model Illuminate\Database\Eloquent\Model
$parentRelation Illuminate\Database\Eloquent\Relations\Relation

loadRelationsAttributesRecursive() protected method

Get the relations attributes from a model.
protected loadRelationsAttributesRecursive ( Model $model )
$model Illuminate\Database\Eloquent\Model

newFromBuilderRecursive() public method

Fill a model with form an elastic hit.
public newFromBuilderRecursive ( Model $model, array $attributes = [], Illuminate\Database\Eloquent\Relations\Relation $parentRelation = null ) : mixed
$model Illuminate\Database\Eloquent\Model
$attributes array
$parentRelation Illuminate\Database\Eloquent\Relations\Relation
return mixed