class ModelMapping

Properties

protected Array $transformers An array mapping each Eloquent Model to a Tansformer class.
protected Array $validators An array mapping each Eloquent Model to a Validator class.
protected array $routes An array mapping each Eloquent Model to a route.
protected Array $default_transformer The default Transformer to use if none specified.
protected Array $default_validator The default Validator to use if none specified.

Methods

getTransformerFor( String $class)

Get the Transformer for a specific model.

getValidatorFor( String $class)

Get the Validator for a specific model.

getUrlFor( Model $model, $absolute = true)

Get the url for a specific model.

Details

at line line 73
Transformer getTransformerFor( String $class)

Get the Transformer for a specific model.

Parameters

String $class Class name of the model

Return Value

Transformer

at line line 89
Validator getValidatorFor( String $class)

Get the Validator for a specific model.

Parameters

String $class Class name of the model

Return Value

Validator

at line line 110
Validator getUrlFor( Model $model, $absolute = true)

Get the url for a specific model.

The url is generated by mapping model attributes to the parameters of a named route. The name of the route and the mapping of model attributes to url parameters is defined in $this->routes.

Parameters

Model $model
$absolute

Return Value

Validator