HandleRepeaters
trait HandleRepeaters (View source)
Properties
protected array | $repeaters | All repeaters used in the model, as an array of repeater names: [ 'article_repeater', 'page_repeater' ]. |
Methods
No description
No description
Given relation, model and repeaterName, retrieve the repeater data from request and update the database record.
Given relation, model and repeaterName, get the necessary fields for rendering a repeater.
Get all repeaters' model and relation from the $repeaters attribute.
Guess the relation name (shoud be lower camel case, ex. userGroup, contactOffice).
Guess the model name (should be singular upper camel case, ex. User, ArticleType).
Details
void
afterSaveHandleRepeaters(Model $object, array $fields)
No description
array
getFormFieldsHandleRepeaters(Model $object, array $fields)
No description
void
updateRepeaterMany(Model $object, array $fields, string $relation, bool $keepExisting = true, Model|null $model = null)
No description
void
updateRepeaterMorphMany(Model $object, array $fields, string $relation, string|null $morph = null, Model|null $model = null, string|null $repeaterName = null)
No description
void
updateRepeater(Model $object, array $fields, string $relation, Model|ModuleRepository|null $modelOrRepository = null, string|null $repeaterName = null)
Given relation, model and repeaterName, retrieve the repeater data from request and update the database record.
array
getFormFieldsForRepeater(Model $object, array $fields, string $relation, Model|ModuleRepository|null $modelOrRepository = null, string|null $repeaterName = null)
Given relation, model and repeaterName, get the necessary fields for rendering a repeater.
protected Collection
getRepeaters()
Get all repeaters' model and relation from the $repeaters attribute.
The missing information will be inferred by convention of Twill.
protected string
inferRelationFromRepeaterName(string $repeaterName)
Guess the relation name (shoud be lower camel case, ex. userGroup, contactOffice).
protected string
inferModelFromRepeaterName(string $repeaterName)
Guess the model name (should be singular upper camel case, ex. User, ArticleType).