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
No description
Given relation, model and repeaterName, retrieve the repeater data from request and update the database record.
No description
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 (should be lower camel case, ex. userGroup, contactOffice).
Guess the model name (should be singular upper camel case, ex. User, ArticleType).
Details
void
afterSaveHandleRepeaters(TwillModelContract $object, array $fields)
No description
array
getFormFieldsHandleRepeaters(TwillModelContract $object, array $fields)
No description
void
updateRepeaterMany(TwillModelContract $object, array $fields, string $relation, bool $keepExisting = true, string|null $model = null)
deprecated
deprecated
No description
void
updateRepeaterMorphMany(TwillModelContract $object, array $fields, string $relation, string|null $morph = null, string|null $model = null, string|null $repeaterName = null)
No description
void
updateRepeaterWithPivot(TwillModelContract $object, array $fields, string $relation, array $pivotFields, string|null $modelOrRepository = null, string|null $repeaterName = null)
No description
void
updateRepeater(TwillModelContract $object, array $fields, string $relation, ModuleRepository $modelOrRepository = null, string|null $repeaterName = null)
Given relation, model and repeaterName, retrieve the repeater data from request and update the database record.
array
getFormFieldForRepeaterWithPivot(TwillModelContract $object, array $fields, string $relation, array $pivotFields, ModuleRepository $modelOrRepository = null, string|null $repeaterName = null)
No description
array
getFormFieldsForRepeater(TwillModelContract $object, array $fields, string $relation, ModuleRepository $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 (should 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).