Source: ~/modules/backend/traits/FormModelSaver.php

Implements special logic for processing form data, typically from from postback, and filling the model attributes and attributes of any related models. This is a customized, safer and simplified version of $model->push().

Protected properties

protected array $modelsToSave

List of prepared models that require saving.

Protected methods

protected void deferPurgedSaveAttributes($model, $attributesToPurge)
  • $model
  • $attributesToPurge

protected array prepareModelsToSave(October\Rain\Database\Model $model, array $saveData)

Takes a model and fills it with data from a multidimensional array. If an attribute is found to be a relationship, that relationship is also filled.

$modelsToSave = $this->prepareModelsToSave($model, [...]);

foreach ($modelsToSave as $modelToSave) {

protected void setModelAttributes($model, $saveData)

Sets a data collection to a model attributes, relations will also be set.

  • $model
  • $saveData