PHP Class Devise\Pages\Models\ModelManager

Datei anzeigen Open project: devisephp/cms Class Usage Examples

Public Methods

Method Description
__construct ( DvsModelField $DvsModelField, Framework $Framework ) Create a new model manager
createFieldsAndModel ( array $fields, array $page ) : array(Collection, Creates a new model from the given fields
updateField ( [type] $field, [type] $page ) : [type] Updates a single field
updateFields ( [type] $fields, [type] $page ) : [type] Update each field in this fields array

Protected Methods

Method Description
createModel ( [type] $fields ) : [type] Creates a new model for the first field type it finds
getCreatedField ( [type] $field ) : [type] Creates a new model field
getCreatedFields ( [type] $fields ) : [type] [createFields description]
getMessages ( [type] $fields ) : [type] Get the messages for these fields
getModelFor ( array $fields ) : Eloquent Get the field's model
getOriginalField ( [type] $field ) : [type] Gets the original field in place of the modified field
getOriginalFields ( [type] $fields ) : [type] Gets all the original fields in place of the modified fields.
getRules ( [type] $fields ) : [type] Get the rules for these fields
getUpdatedFields ( array $fields ) : Collection Get the updated fields
getValues ( array $fields, Eloquent $model, $page ) : array Gets the picked values for the entered fields
removeAnyBadModelFields ( [type] $fields ) : [type] Sometimes errors and stuff can cause invalid model fields in our database.
removeFields ( [type] $fields ) : [type] Removes these fields since the validation failed.
restoreOriginalFields ( $originals ) : void Restores the original fields, since validation failed

Method Details

__construct() public method

Create a new model manager
public __construct ( DvsModelField $DvsModelField, Framework $Framework )
$DvsModelField DvsModelField [description]
$Framework Devise\Support\Framework [description]

createFieldsAndModel() public method

Creates a new model from the given fields
public createFieldsAndModel ( array $fields, array $page ) : array(Collection,
$fields array
$page array
return array(Collection,

createModel() protected method

Creates a new model for the first field type it finds
protected createModel ( [type] $fields ) : [type]
$fields [type]
return [type]

getCreatedField() protected method

Creates a new model field
protected getCreatedField ( [type] $field ) : [type]
$field [type]
return [type]

getCreatedFields() protected method

[createFields description]
protected getCreatedFields ( [type] $fields ) : [type]
$fields [type]
return [type]

getMessages() protected method

Get the messages for these fields
protected getMessages ( [type] $fields ) : [type]
$fields [type]
return [type]

getModelFor() protected method

Get the field's model
protected getModelFor ( array $fields ) : Eloquent
$fields array
return Eloquent

getOriginalField() protected method

Gets the original field in place of the modified field
protected getOriginalField ( [type] $field ) : [type]
$field [type]
return [type]

getOriginalFields() protected method

.. this is useful for when our validation fails
protected getOriginalFields ( [type] $fields ) : [type]
$fields [type]
return [type]

getRules() protected method

Get the rules for these fields
protected getRules ( [type] $fields ) : [type]
$fields [type]
return [type]

getUpdatedFields() protected method

Get the updated fields
protected getUpdatedFields ( array $fields ) : Collection
$fields array
return Collection

getValues() protected method

Gets the picked values for the entered fields
protected getValues ( array $fields, Eloquent $model, $page ) : array
$fields array
$model Eloquent
return array

removeAnyBadModelFields() protected method

.. this just removes any just in case...
protected removeAnyBadModelFields ( [type] $fields ) : [type]
$fields [type]
return [type]

removeFields() protected method

..
protected removeFields ( [type] $fields ) : [type]
$fields [type]
return [type]

restoreOriginalFields() protected method

Restores the original fields, since validation failed
protected restoreOriginalFields ( $originals ) : void
return void

updateField() public method

Updates a single field
public updateField ( [type] $field, [type] $page ) : [type]
$field [type]
$page [type]
return [type]

updateFields() public method

Update each field in this fields array
public updateFields ( [type] $fields, [type] $page ) : [type]
$fields [type]
$page [type]
return [type]