Backend\Traits\FormModelWidget

Overview

FormModelWidget Trait

Special logic for for form widgets that use a database stored model.


Public Methods

public nearestModelAttribute()

public nearestModelAttribute($attribute): void

public resolveModelAttribute()

public resolveModelAttribute(string $attribute): array 

Returns the final model and attribute name of a nested HTML array attribute. Eg: [$model, $attribute] = $this->resolveModelAttribute($this->valueFrom);

Protected Methods

protected getRelationModel()

protected getRelationModel(): Relation 

Returns the model of a relation type, supports nesting via HTML array.

protected getRelationObject()

protected getRelationObject(): Relation 

Returns the value as a relation object from the model, supports nesting via HTML array.

protected getRelationType()

protected getRelationType(): string 

getRelationType returns the value as a relation type from the model, supports nesting via HTML array.

protected isRelationTypeSingular()

protected isRelationTypeSingular(): bool 

isRelationTypeSingular checks if the related model is singular.