getModelArrayAttribute -> resolveModelAttribute
This commit is contained in:
parent
d91d4112a5
commit
5d2a177646
|
|
@ -103,7 +103,7 @@ abstract class FormWidgetBase extends WidgetBase
|
|||
*/
|
||||
public function getLoadValue()
|
||||
{
|
||||
list($model, $attribute) = $this->getModelArrayAttribute($this->valueFrom);
|
||||
list($model, $attribute) = $this->resolveModelAttribute($this->valueFrom);
|
||||
|
||||
if (!is_null($model)) {
|
||||
return $model->{$attribute};
|
||||
|
|
@ -115,11 +115,11 @@ abstract class FormWidgetBase extends WidgetBase
|
|||
/**
|
||||
* Returns the final model and attribute name of
|
||||
* a nested HTML array attribute.
|
||||
* Eg: list($model, $attribute) = $this->getModelArrayAttribute($this->valueFrom);
|
||||
* Eg: list($model, $attribute) = $this->resolveModelAttribute($this->valueFrom);
|
||||
* @param string $attribute.
|
||||
* @return array
|
||||
*/
|
||||
public function getModelArrayAttribute($attribute)
|
||||
public function resolveModelAttribute($attribute)
|
||||
{
|
||||
$model = $this->model;
|
||||
$parts = Str::evalHtmlArray($attribute);
|
||||
|
|
|
|||
|
|
@ -109,7 +109,7 @@ class FileUpload extends FormWidgetBase
|
|||
*/
|
||||
protected function getRelationObject()
|
||||
{
|
||||
list($model, $attribute) = $this->getModelArrayAttribute($this->valueFrom);
|
||||
list($model, $attribute) = $this->resolveModelAttribute($this->valueFrom);
|
||||
return $model->{$attribute}();
|
||||
}
|
||||
|
||||
|
|
@ -120,7 +120,7 @@ class FileUpload extends FormWidgetBase
|
|||
*/
|
||||
protected function getRelationType()
|
||||
{
|
||||
list($model, $attribute) = $this->getModelArrayAttribute($this->valueFrom);
|
||||
list($model, $attribute) = $this->resolveModelAttribute($this->valueFrom);
|
||||
return $model->getRelationType($attribute);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -130,7 +130,7 @@ class RecordFinder extends FormWidgetBase
|
|||
|
||||
public function onRefresh()
|
||||
{
|
||||
list($model, $attribute) = $this->getModelArrayAttribute($this->valueFrom);
|
||||
list($model, $attribute) = $this->resolveModelAttribute($this->valueFrom);
|
||||
$model->{$attribute} = post($this->formField->getName());
|
||||
|
||||
$this->prepareVars();
|
||||
|
|
|
|||
|
|
@ -104,7 +104,7 @@ class Relation extends FormWidgetBase
|
|||
|
||||
$field = clone $this->formField;
|
||||
|
||||
list($model, $attribute) = $this->getModelArrayAttribute($this->relationName);
|
||||
list($model, $attribute) = $this->resolveModelAttribute($this->relationName);
|
||||
$relatedObj = $model->makeRelation($attribute);
|
||||
$query = $model->{$attribute}()->newQuery();
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue